@vincentt-xr/sdk 2.0.0-alpha.20 → 2.0.0-alpha.22

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.
Files changed (61) hide show
  1. package/components.json +1 -1
  2. package/dist/{CanonicalHeadFrame-CQe2YX9a.js → CanonicalHeadFrame-S3Jk9F1P.js} +15 -15
  3. package/dist/{DebuggerUI-CKYrYmod.js → DebuggerUI-B8bheFk-.js} +1 -1
  4. package/dist/{FaceRetouch-l7y4oZBu.js → FaceRetouch-DW_9g5EA.js} +4 -4
  5. package/dist/{bodyMaskMaterial-BOdSJUEM.js → bodyMaskMaterial-CUlzyXnJ.js} +1 -1
  6. package/dist/cache-CsH3zPDX.js +307 -0
  7. package/dist/cache-DrEDi7qn.cjs +1 -0
  8. package/dist/components/Button/index.d.ts +1 -1
  9. package/dist/components/FaceSwap/settings.d.ts +1 -1
  10. package/dist/components/Light/index.d.ts +1 -1
  11. package/dist/components/Model/index.d.ts +1 -1
  12. package/dist/components/Object3D/index.d.ts +1 -1
  13. package/dist/components/PaintedFace/index.d.ts +1 -1
  14. package/dist/components/ScreenText/liveEditable.d.ts +1 -1
  15. package/dist/{contexts-Cl-4dUOI.js → contexts-C_l5hzI8.js} +52 -52
  16. package/dist/debug-ui/media-source.js +1 -1
  17. package/dist/debug-ui.cjs +1 -1
  18. package/dist/debug-ui.js +11 -11
  19. package/dist/{drawNormalizedCrop-D606u5-F.js → drawNormalizedCrop-D48Layv4.js} +14 -14
  20. package/dist/editor-defs/live.d.ts +18 -0
  21. package/dist/editor-defs/live.generated.d.ts +2 -0
  22. package/dist/face-effects.cjs +31 -31
  23. package/dist/face-effects.js +1287 -1287
  24. package/dist/{getFaceInfo-Mt44zlej.js → getFaceInfo-e9XzHPLC.js} +1 -1
  25. package/dist/{index-CicO_Tnw.js → index-B34w-TyW.js} +1 -1
  26. package/dist/{index-D5NbXaCn.js → index-B9ph9k5I.js} +4 -4
  27. package/dist/{index-Bn72laBn.js → index-BKZPBg1D.js} +1 -1
  28. package/dist/{index-CM3jkleV.js → index-DCjFgbB8.js} +12 -10
  29. package/dist/{index-fDwL47CM.cjs → index-DSMv6GWI.cjs} +1 -1
  30. package/dist/{index-CbBCl2ZU.js → index-Dk1UOe-H.js} +10 -10
  31. package/dist/{index-BDxJWWyy.js → index-MzlPbe9t.js} +9 -9
  32. package/dist/{index-B0EYdofX.js → index-em1AaMkI.js} +1 -1
  33. package/dist/instructions.js +7 -7
  34. package/dist/{internal-BoFDq5hC.js → internal-kwJxojDs.js} +3 -3
  35. package/dist/internal.js +2 -2
  36. package/dist/{landmarks-C3LvDhMt.js → landmarks-BgLF-yfd.js} +6 -6
  37. package/dist/low-level.js +17 -17
  38. package/dist/main.cjs +1 -1
  39. package/dist/main.js +770 -762
  40. package/dist/particles.js +5 -5
  41. package/dist/product.js +2 -2
  42. package/dist/{providers-Bxt_MfPK.js → providers-Bo1gfoXg.js} +3 -3
  43. package/dist/{renderGroups-uYPzUa66.js → renderGroups-Cul4eOG8.js} +1 -1
  44. package/dist/{renderPasses-C0wu5Cwg.js → renderPasses-CLOTeP38.js} +40 -40
  45. package/dist/scene-object.js +2 -2
  46. package/dist/{segmentation-DccvYBBO.js → segmentation-Q1eXSt_x.js} +1 -1
  47. package/dist/{selectors-J06V0eDb.js → selectors-CiawE6Ox.js} +4 -4
  48. package/dist/{session-CYiWfcvz.js → session-CmpigDxI.js} +9 -9
  49. package/dist/tracking.js +127 -127
  50. package/dist/{trigger-CQviD4xp.js → trigger-BHKfnvtB.js} +7 -7
  51. package/dist/{useBodies-DOuwRuew.js → useBodies-DzRzQg88.js} +7 -7
  52. package/dist/{useFaceInfo-XUGYTdfN.js → useFaceInfo-DUxqnPek.js} +10 -10
  53. package/dist/{useFaceResultReader-D8wXbF1L.js → useFaceResultReader-DSnUjQcw.js} +1 -1
  54. package/dist/{useIrisTracking-B0uLWgNE.js → useIrisTracking-Bfp1Fv66.js} +10 -10
  55. package/dist/{useXRCapabilities-DPUOvpdf.js → useXRCapabilities-BhN_CKwJ.js} +1 -1
  56. package/dist/utils/useEditOverrides.d.ts +4 -0
  57. package/dist/utils/useLiveProps.d.ts +8 -0
  58. package/package.json +1 -1
  59. package/settings.json +1 -1
  60. package/dist/cache-DFqZYsHC.cjs +0 -1
  61. package/dist/cache-Mu-VO_6E.js +0 -212
package/components.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "schema": "vincentt.components/1",
3
3
  "package": "@vincentt-xr/sdk",
4
- "version": "2.0.0-alpha.20",
4
+ "version": "2.0.0-alpha.22",
5
5
  "components": {
6
6
  "AudioPlayer": {
7
7
  "kind": "sound",
@@ -2,9 +2,9 @@ import { jsx as _ } from "react/jsx-runtime";
2
2
  import { useCallback as H, useRef as S, createContext as g } from "react";
3
3
  import { useThree as h } from "@react-three/fiber";
4
4
  import * as l from "three";
5
- import { j as w, n as d } from "./index-BDxJWWyy.js";
6
- import { u as P } from "./index-CbBCl2ZU.js";
7
- import { b as y } from "./selectors-J06V0eDb.js";
5
+ import { f as w, n as f } from "./index-MzlPbe9t.js";
6
+ import { u as P } from "./index-Dk1UOe-H.js";
7
+ import { u as y } from "./selectors-CiawE6Ox.js";
8
8
  import { s as M } from "./similarityFit-Bbz-R8AY.js";
9
9
  import { L as k, u as v } from "./useLandmarkPoseFit-Bmb3h6Mw.js";
10
10
  const Y = /* @__PURE__ */ Float32Array.from([
@@ -1446,7 +1446,7 @@ const Y = /* @__PURE__ */ Float32Array.from([
1446
1446
  [243, -1.6396, 2.5563, 3.8637]
1447
1447
  ], Z = [0, -0.46317, 7.58658], O = Float64Array.from(
1448
1448
  L.flatMap(([, o, t, e]) => [o, t, e])
1449
- ), f = L.map(([o]) => o), $ = (o, t) => {
1449
+ ), d = L.map(([o]) => o), $ = (o, t) => {
1450
1450
  const e = t ?? {
1451
1451
  scale: 1,
1452
1452
  quaternion: new l.Quaternion(),
@@ -1455,8 +1455,8 @@ const Y = /* @__PURE__ */ Float32Array.from([
1455
1455
  worldUnitsPerCm: 1,
1456
1456
  count: 0
1457
1457
  };
1458
- return M(O, o, e), e.worldUnitsPerCm = e.scale, e.count = f.length, e;
1459
- }, G = k, U = { x: 0, y: 0.5 }, b = { x: 1, y: 0.5 }, n = new l.Vector3(), p = new l.Vector3(), K = (o, {
1458
+ return M(O, o, e), e.worldUnitsPerCm = e.scale, e.count = d.length, e;
1459
+ }, G = k, U = { x: 0, y: 0.5 }, K = { x: 1, y: 0.5 }, n = new l.Vector3(), p = new l.Vector3(), V = (o, {
1460
1460
  faceIndex: t,
1461
1461
  offset: e,
1462
1462
  smoothing: R = G,
@@ -1469,11 +1469,11 @@ const Y = /* @__PURE__ */ Float32Array.from([
1469
1469
  var A, u;
1470
1470
  const m = (u = (A = r == null ? void 0 : r.detectionResults) == null ? void 0 : A.faceLandmarks) == null ? void 0 : u[C];
1471
1471
  if (!m || m.length < 468) return !1;
1472
- d(U, c, n, 0), d(b, c, p, 0);
1472
+ f(U, c, n, 0), f(K, c, p, 0);
1473
1473
  const D = n.distanceTo(p);
1474
- for (let a = 0; a < f.length; a += 1) {
1475
- const I = m[f[a]], N = -(I.z ?? 0) * D;
1476
- d(I, c, n, N), i[a * 3] = n.x, i[a * 3 + 1] = n.y, i[a * 3 + 2] = N;
1474
+ for (let a = 0; a < d.length; a += 1) {
1475
+ const I = m[d[a]], N = -(I.z ?? 0) * D;
1476
+ f(I, c, n, N), i[a * 3] = n.x, i[a * 3 + 1] = n.y, i[a * 3 + 2] = N;
1477
1477
  }
1478
1478
  return !0;
1479
1479
  },
@@ -1488,19 +1488,19 @@ const Y = /* @__PURE__ */ Float32Array.from([
1488
1488
  onFit: F,
1489
1489
  onTrackingChange: x
1490
1490
  });
1491
- }, V = g(!1), e3 = ({ children: o, ...t }) => {
1491
+ }, W = g(!1), e3 = ({ children: o, ...t }) => {
1492
1492
  const e = S(null);
1493
- return K(e, t), /* @__PURE__ */ _(V.Provider, { value: !0, children: /* @__PURE__ */ _("group", { ref: e, children: o }) });
1493
+ return V(e, t), /* @__PURE__ */ _(W.Provider, { value: !0, children: /* @__PURE__ */ _("group", { ref: e, children: o }) });
1494
1494
  };
1495
1495
  export {
1496
1496
  Y as C,
1497
1497
  e3 as a,
1498
- f as b,
1498
+ d as b,
1499
1499
  O as c,
1500
- V as d,
1500
+ W as d,
1501
1501
  G as e,
1502
1502
  Z as f,
1503
1503
  L as g,
1504
1504
  $ as s,
1505
- K as u
1505
+ V as u
1506
1506
  };
@@ -1,7 +1,7 @@
1
1
  import { jsx as e, jsxs as n, Fragment as u } from "react/jsx-runtime";
2
2
  import { useState as k, useEffect as w } from "react";
3
3
  import { createPortal as R } from "react-dom";
4
- import { f as i } from "./internal-BoFDq5hC.js";
4
+ import { f as i } from "./internal-kwJxojDs.js";
5
5
  const v = {
6
6
  position: "fixed",
7
7
  top: "10px",
@@ -1,12 +1,12 @@
1
- import { F as v, a as q, b as B, c as N, d as J, e as d, f as R } from "./renderPasses-C0wu5Cwg.js";
1
+ import { F as v, a as q, b as B, c as N, d as J, e as d, f as R } from "./renderPasses-CLOTeP38.js";
2
2
  import * as S from "three";
3
3
  import { jsx as _, jsxs as ge } from "react/jsx-runtime";
4
4
  import { useMemo as M, useEffect as Q } from "react";
5
- import { j as fe } from "./index-BDxJWWyy.js";
6
- import { u as be } from "./landmarks-C3LvDhMt.js";
5
+ import { f as fe } from "./index-MzlPbe9t.js";
6
+ import { u as be } from "./landmarks-BgLF-yfd.js";
7
7
  import { F as ve, r as Se, a as ye } from "./renderState-CJNmj5jz.js";
8
8
  import { useThree as ke, useFrame as xe } from "@react-three/fiber";
9
- import { c as Ee } from "./selectors-J06V0eDb.js";
9
+ import { c as Ee } from "./selectors-CiawE6Ox.js";
10
10
  import { f as Me } from "./FaceSurface-DmP9AEeC.js";
11
11
  import { c as Re, d as we } from "./landmarkMask-DHivVjJm.js";
12
12
  const ht = [
@@ -1,5 +1,5 @@
1
1
  import * as p from "three";
2
- import { B as e, X as S } from "./index-BDxJWWyy.js";
2
+ import { B as e, X as S } from "./index-MzlPbe9t.js";
3
3
  const b = [
4
4
  [e.leftShoulder, e.rightShoulder],
5
5
  [e.leftHip, e.rightHip],
@@ -0,0 +1,307 @@
1
+ var x = Object.defineProperty;
2
+ var A = (s, e, t) => e in s ? x(s, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : s[e] = t;
3
+ var a = (s, e, t) => A(s, typeof e != "symbol" ? e + "" : e, t);
4
+ import { u as k } from "./useEditOverrides-BBkK8cN2.js";
5
+ import { useMemo as g, useCallback as d } from "react";
6
+ import { u as S, r as m, h as E, l as L, j as T, k as B } from "./index-MzlPbe9t.js";
7
+ import { a as _, b as v } from "./selectors-CiawE6Ox.js";
8
+ const C = {
9
+ AudioPlayer: {
10
+ src: { c: "file" },
11
+ volume: { c: "number", min: 0, max: 100 },
12
+ playMode: { c: "choice", options: ["once", "loop", "infinite"] }
13
+ },
14
+ Button: {
15
+ label: { c: "shortText", maxLength: 40 },
16
+ action: { c: "choice", options: ["link", "scene"] },
17
+ link: { c: "link", maxLength: 2048 },
18
+ target: { c: "choice" },
19
+ color: { c: "colour" },
20
+ visible: { c: "switch" }
21
+ },
22
+ Light: {
23
+ type: { c: "choice", options: ["ambient", "directional", "point", "spot"] },
24
+ color: { c: "colour" },
25
+ intensity: { c: "number", min: 0 },
26
+ enabled: { c: "switch" },
27
+ castShadow: { c: "switch" },
28
+ distance: { c: "number", min: 0 },
29
+ decay: { c: "number", min: 0 },
30
+ angle: { c: "number", min: 0, max: 1.57 },
31
+ penumbra: { c: "number", min: 0, max: 1 }
32
+ },
33
+ Model: { src: { c: "file" } },
34
+ Object3D: {
35
+ colour: { c: "colour" },
36
+ texture: { c: "file" },
37
+ size: { c: "number", min: 0 },
38
+ visible: { c: "switch" }
39
+ },
40
+ PaintedFace: {
41
+ src: { c: "file" },
42
+ amount: { c: "number", min: 0, max: 1 },
43
+ layout: { c: "choice", options: ["asIs", "flip", "upsideDown"] },
44
+ ownEyes: { c: "switch" },
45
+ ownMouth: { c: "switch" },
46
+ visible: { c: "switch" }
47
+ },
48
+ Scene: {
49
+ label: { c: "shortText", maxLength: 60 },
50
+ overlay: { c: "switch" },
51
+ open: { c: "switch" },
52
+ over: { c: "shortText", maxLength: 64 }
53
+ },
54
+ ScreenImage: { src: { c: "file" } },
55
+ ScreenText: {
56
+ text: { c: "longText", maxLength: 500 },
57
+ color: { c: "colour" },
58
+ fontSize: { c: "number", min: 1 },
59
+ textAlign: { c: "choice", options: ["left", "center", "right"] }
60
+ }
61
+ }, M = /^#[0-9a-fA-F]{6}$/, w = 4096, Q = (s) => typeof s == "string" && s.length <= w && (s.startsWith("https://") || s.startsWith("/") && s.length > 1 && s[1] !== "/" && s[1] !== "\\" && s.charCodeAt(1) > 32);
62
+ function U(s, e) {
63
+ switch (s.c) {
64
+ case "colour":
65
+ return typeof e == "string" && M.test(e);
66
+ case "number":
67
+ return typeof e == "number" && Number.isFinite(e) && (s.min === void 0 || e >= s.min) && (s.max === void 0 || e <= s.max);
68
+ case "switch":
69
+ return typeof e == "boolean";
70
+ case "choice":
71
+ return typeof e == "string" && (s.options === void 0 || s.options.includes(e));
72
+ case "shortText":
73
+ case "longText":
74
+ return typeof e == "string" && [...e].length <= (s.maxLength ?? 2e3);
75
+ case "link":
76
+ return typeof e == "string" && e.length <= w;
77
+ case "file":
78
+ return Q(e);
79
+ }
80
+ }
81
+ const p = /* @__PURE__ */ new Map();
82
+ function z(s, e) {
83
+ const t = p.get(s);
84
+ if (t && e.length === 0) return t;
85
+ const r = C[s] ?? {}, o = {};
86
+ for (const [n, c] of Object.entries(r)) o[n] = (l) => U(c, l);
87
+ const i = { keys: [...Object.keys(r), ...e], accept: o };
88
+ return e.length === 0 && p.set(s, i), i;
89
+ }
90
+ function P(s, e, t = [], r = {}) {
91
+ const o = z(s, t);
92
+ return k(
93
+ e,
94
+ o.keys,
95
+ {
96
+ ...o.accept,
97
+ ...r
98
+ }
99
+ );
100
+ }
101
+ const j = (s) => {
102
+ const { session: e } = S(), t = _(), r = v(), o = JSON.stringify(s ?? null), i = g(
103
+ () => s ? m(s) : r ?? m(),
104
+ [o, r]
105
+ // eslint-disable-line react-hooks/exhaustive-deps
106
+ ), n = i.tiers, c = d(
107
+ (u) => {
108
+ const h = e.store.getSnapshot().quality;
109
+ h && e._setQuality(E(h, i, u, performance.now()));
110
+ },
111
+ [e, i]
112
+ ), l = d(
113
+ (u) => {
114
+ const h = e.store.getSnapshot().quality;
115
+ h && e._setQuality(L(h, i, u, performance.now()));
116
+ },
117
+ [e, i]
118
+ ), y = d(() => {
119
+ const u = e.store.getSnapshot().quality;
120
+ e._setQuality(
121
+ T(i, (u == null ? void 0 : u.signals) ?? B, performance.now())
122
+ );
123
+ }, [e, i]);
124
+ return g(
125
+ () => ({
126
+ tier: (t == null ? void 0 : t.decision.tier) ?? null,
127
+ index: (t == null ? void 0 : t.index) ?? -1,
128
+ tiers: n,
129
+ decision: (t == null ? void 0 : t.decision) ?? null,
130
+ history: (t == null ? void 0 : t.history) ?? [],
131
+ signals: (t == null ? void 0 : t.signals) ?? null,
132
+ locked: (t == null ? void 0 : t.locked) ?? !1,
133
+ setTier: c,
134
+ lock: () => l(!0),
135
+ unlock: () => l(!1),
136
+ reset: y,
137
+ state: t
138
+ }),
139
+ [t, n, c, l, y]
140
+ );
141
+ }, F = 256 * 1024 * 1024;
142
+ class X {
143
+ constructor(e = {}) {
144
+ a(this, "entries", /* @__PURE__ */ new Map());
145
+ a(this, "listeners", /* @__PURE__ */ new Set());
146
+ a(this, "budget");
147
+ a(this, "now");
148
+ a(this, "evictions", 0);
149
+ a(this, "hits", 0);
150
+ a(this, "misses", 0);
151
+ /** Memoised `getStats()` result; cleared on every change so `useSyncExternalStore` sees a stable snapshot. */
152
+ a(this, "statsSnapshot", null);
153
+ this.budget = e.budgetBytes ?? F, this.now = e.now ?? (() => typeof performance < "u" ? performance.now() : Date.now());
154
+ }
155
+ /** Acquire `asset` on behalf of `ownerId`; shares an in-flight or loaded value. */
156
+ acquire(e, t) {
157
+ let r = this.entries.get(e.key);
158
+ if (r && r.status === "error" && (this.entries.delete(e.key), r = void 0), !r) {
159
+ this.misses += 1;
160
+ const o = typeof AbortController < "u" ? new AbortController() : null, i = {
161
+ definition: e,
162
+ status: "loading",
163
+ value: void 0,
164
+ bytes: 0,
165
+ owners: /* @__PURE__ */ new Set([t]),
166
+ promise: null,
167
+ controller: o,
168
+ error: null,
169
+ lastUsed: this.now(),
170
+ disposed: !1
171
+ };
172
+ return i.promise = e.load((o == null ? void 0 : o.signal) ?? new AbortController().signal).then((n) => {
173
+ var c, l;
174
+ if (i.disposed || this.entries.get(e.key) !== i)
175
+ throw (c = e.dispose) == null || c.call(e, n), new Error(`Asset "${e.key}" was released before it loaded`);
176
+ return i.value = n, i.bytes = Math.max(0, Math.round(((l = e.bytes) == null ? void 0 : l.call(e, n)) ?? 0)), i.status = "ready", i.promise = null, this.notify(), this.enforceBudget(), n;
177
+ }).catch((n) => {
178
+ const c = n instanceof Error ? n : new Error(String(n));
179
+ throw this.entries.get(e.key) === i && !i.disposed && (i.status = "error", i.error = c, i.promise = null, this.notify()), c;
180
+ }), this.entries.set(e.key, i), this.notify(), i.promise;
181
+ }
182
+ return this.hits += 1, r.owners.add(t), r.lastUsed = this.now(), this.notify(), r.status === "ready" ? Promise.resolve(r.value) : r.promise;
183
+ }
184
+ /** Start loading without holding a reference (warm the cache). */
185
+ preload(e) {
186
+ const t = "__preload__";
187
+ return this.acquire(e, t).finally(() => this.release(e.key, t));
188
+ }
189
+ /** Drop `ownerId`'s reference. The value stays cached until evicted or disposed. */
190
+ release(e, t) {
191
+ var o;
192
+ const r = this.entries.get(e);
193
+ !r || !r.owners.delete(t) || (r.lastUsed = this.now(), r.owners.size === 0 && r.status === "loading" && ((o = r.controller) == null || o.abort(), r.disposed = !0, this.entries.delete(e)), this.notify(), this.enforceBudget());
194
+ }
195
+ /** Synchronous read of a loaded value (or `undefined`). Does not take a reference. */
196
+ get(e) {
197
+ const t = this.entries.get(e);
198
+ return (t == null ? void 0 : t.status) === "ready" ? t.value : void 0;
199
+ }
200
+ has(e) {
201
+ return this.entries.has(e);
202
+ }
203
+ entry(e) {
204
+ const t = this.entries.get(e);
205
+ return t ? b(e, t) : void 0;
206
+ }
207
+ list() {
208
+ return Array.from(this.entries, ([e, t]) => b(e, t));
209
+ }
210
+ setBudget(e) {
211
+ this.budget = e, this.enforceBudget(), this.notify();
212
+ }
213
+ /**
214
+ * Dispose unreferenced values, least recently used first, until usage is
215
+ * within the budget (or `bytesToFree` is reclaimed). Referenced values are
216
+ * never touched. Returns the bytes reclaimed.
217
+ */
218
+ evict(e) {
219
+ const t = e ?? Math.max(0, this.usage() - (Number.isFinite(this.budget) ? this.budget : 1 / 0));
220
+ if (t <= 0) return 0;
221
+ const r = Array.from(this.entries).filter(([, i]) => i.owners.size === 0 && i.status === "ready").sort((i, n) => i[1].lastUsed - n[1].lastUsed);
222
+ let o = 0;
223
+ for (const [i, n] of r) {
224
+ if (o >= t) break;
225
+ o += n.bytes, this.disposeEntry(i, n), this.evictions += 1;
226
+ }
227
+ return o > 0 && this.notify(), o;
228
+ }
229
+ /** Dispose every unreferenced value (route change, scene teardown). Returns the bytes freed. */
230
+ disposeUnreferenced() {
231
+ let e = 0;
232
+ for (const [t, r] of Array.from(this.entries))
233
+ r.owners.size === 0 && (e += r.bytes, this.disposeEntry(t, r));
234
+ return e > 0 && this.notify(), e;
235
+ }
236
+ /** Dispose everything, referenced or not (app / session shutdown). Owners are forgotten. */
237
+ disposeAll() {
238
+ for (const [e, t] of Array.from(this.entries)) this.disposeEntry(e, t);
239
+ this.notify();
240
+ }
241
+ /** Current statistics. The object is reused until the cache changes, so it is safe as a store snapshot. */
242
+ getStats() {
243
+ if (this.statsSnapshot) return this.statsSnapshot;
244
+ let e = 0, t = 0, r = 0, o = 0, i = 0;
245
+ for (const n of this.entries.values())
246
+ n.owners.size > 0 && (e += 1), n.status === "loading" && (t += 1), n.status === "error" && (r += 1), n.status === "ready" && (o += n.bytes, n.owners.size === 0 && (i += n.bytes));
247
+ return this.statsSnapshot = {
248
+ assets: this.entries.size,
249
+ referencedAssets: e,
250
+ loadingAssets: t,
251
+ erroredAssets: r,
252
+ usageBytes: o,
253
+ reclaimableBytes: i,
254
+ budgetBytes: this.budget,
255
+ overBudget: o > this.budget,
256
+ evictions: this.evictions,
257
+ hits: this.hits,
258
+ misses: this.misses
259
+ }, this.statsSnapshot;
260
+ }
261
+ subscribe(e) {
262
+ return this.listeners.add(e), () => {
263
+ this.listeners.delete(e);
264
+ };
265
+ }
266
+ usage() {
267
+ let e = 0;
268
+ for (const t of this.entries.values()) t.status === "ready" && (e += t.bytes);
269
+ return e;
270
+ }
271
+ enforceBudget() {
272
+ Number.isFinite(this.budget) && this.usage() > this.budget && this.evict();
273
+ }
274
+ disposeEntry(e, t) {
275
+ var r, o, i;
276
+ if (!t.disposed) {
277
+ if (t.disposed = !0, (r = t.controller) == null || r.abort(), t.status === "ready" && t.value !== void 0)
278
+ try {
279
+ (i = (o = t.definition).dispose) == null || i.call(o, t.value);
280
+ } catch (n) {
281
+ console.warn(`[xr-sdk assets] dispose threw for ${e}`, n);
282
+ }
283
+ this.entries.delete(e);
284
+ }
285
+ }
286
+ notify() {
287
+ this.statsSnapshot = null, this.listeners.forEach((e) => e());
288
+ }
289
+ }
290
+ const b = (s, e) => ({
291
+ key: s,
292
+ status: e.status,
293
+ bytes: e.bytes,
294
+ owners: e.owners.size,
295
+ lastUsed: e.lastUsed,
296
+ error: e.error
297
+ }), D = (s) => new X(s);
298
+ let f;
299
+ const Y = () => (f || (f = D()), f);
300
+ export {
301
+ F as D,
302
+ X,
303
+ j as a,
304
+ D as c,
305
+ Y as g,
306
+ P as u
307
+ };
@@ -0,0 +1 @@
1
+ "use strict";var k=Object.defineProperty;var E=(s,e,t)=>e in s?k(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t;var l=(s,e,t)=>E(s,typeof e!="symbol"?e+"":e,t);const T=require("./useEditOverrides-CgapHJzA.cjs"),f=require("react"),h=require("./index-J3Qy6hi3.cjs"),p=require("./selectors-Bq6tSgOY.cjs"),C={AudioPlayer:{src:{c:"file"},volume:{c:"number",min:0,max:100},playMode:{c:"choice",options:["once","loop","infinite"]}},Button:{label:{c:"shortText",maxLength:40},action:{c:"choice",options:["link","scene"]},link:{c:"link",maxLength:2048},target:{c:"choice"},color:{c:"colour"},visible:{c:"switch"}},Light:{type:{c:"choice",options:["ambient","directional","point","spot"]},color:{c:"colour"},intensity:{c:"number",min:0},enabled:{c:"switch"},castShadow:{c:"switch"},distance:{c:"number",min:0},decay:{c:"number",min:0},angle:{c:"number",min:0,max:1.57},penumbra:{c:"number",min:0,max:1}},Model:{src:{c:"file"}},Object3D:{colour:{c:"colour"},texture:{c:"file"},size:{c:"number",min:0},visible:{c:"switch"}},PaintedFace:{src:{c:"file"},amount:{c:"number",min:0,max:1},layout:{c:"choice",options:["asIs","flip","upsideDown"]},ownEyes:{c:"switch"},ownMouth:{c:"switch"},visible:{c:"switch"}},Scene:{label:{c:"shortText",maxLength:60},overlay:{c:"switch"},open:{c:"switch"},over:{c:"shortText",maxLength:64}},ScreenImage:{src:{c:"file"}},ScreenText:{text:{c:"longText",maxLength:500},color:{c:"colour"},fontSize:{c:"number",min:1},textAlign:{c:"choice",options:["left","center","right"]}}},L=/^#[0-9a-fA-F]{6}$/,w=4096,_=s=>typeof s=="string"&&s.length<=w&&(s.startsWith("https://")||s.startsWith("/")&&s.length>1&&s[1]!=="/"&&s[1]!=="\\"&&s.charCodeAt(1)>32);function v(s,e){switch(s.c){case"colour":return typeof e=="string"&&L.test(e);case"number":return typeof e=="number"&&Number.isFinite(e)&&(s.min===void 0||e>=s.min)&&(s.max===void 0||e<=s.max);case"switch":return typeof e=="boolean";case"choice":return typeof e=="string"&&(s.options===void 0||s.options.includes(e));case"shortText":case"longText":return typeof e=="string"&&[...e].length<=(s.maxLength??2e3);case"link":return typeof e=="string"&&e.length<=w;case"file":return _(e)}}const m=new Map;function B(s,e){const t=m.get(s);if(t&&e.length===0)return t;const r=C[s]??{},o={};for(const[n,c]of Object.entries(r))o[n]=a=>v(c,a);const i={keys:[...Object.keys(r),...e],accept:o};return e.length===0&&m.set(s,i),i}function Q(s,e,t=[],r={}){const o=B(s,t);return T.useEditOverrides(e,o.keys,{...o.accept,...r})}const U=s=>{const{session:e}=h.useXRContext(),t=p.useXRQualityState(),r=p.useXRQualityConfig(),o=JSON.stringify(s??null),i=f.useMemo(()=>s?h.resolveQualityConfig(s):r??h.resolveQualityConfig(),[o,r]),n=i.tiers,c=f.useCallback(u=>{const d=e.store.getSnapshot().quality;d&&e._setQuality(h.setQualityTier(d,i,u,performance.now()))},[e,i]),a=f.useCallback(u=>{const d=e.store.getSnapshot().quality;d&&e._setQuality(h.lockQuality(d,i,u,performance.now()))},[e,i]),g=f.useCallback(()=>{const u=e.store.getSnapshot().quality;e._setQuality(h.resetQuality(i,(u==null?void 0:u.signals)??h.EMPTY_QUALITY_SIGNALS,performance.now()))},[e,i]);return f.useMemo(()=>({tier:(t==null?void 0:t.decision.tier)??null,index:(t==null?void 0:t.index)??-1,tiers:n,decision:(t==null?void 0:t.decision)??null,history:(t==null?void 0:t.history)??[],signals:(t==null?void 0:t.signals)??null,locked:(t==null?void 0:t.locked)??!1,setTier:c,lock:()=>a(!0),unlock:()=>a(!1),reset:g,state:t}),[t,n,c,a,g])},A=256*1024*1024;class S{constructor(e={}){l(this,"entries",new Map);l(this,"listeners",new Set);l(this,"budget");l(this,"now");l(this,"evictions",0);l(this,"hits",0);l(this,"misses",0);l(this,"statsSnapshot",null);this.budget=e.budgetBytes??A,this.now=e.now??(()=>typeof performance<"u"?performance.now():Date.now())}acquire(e,t){let r=this.entries.get(e.key);if(r&&r.status==="error"&&(this.entries.delete(e.key),r=void 0),!r){this.misses+=1;const o=typeof AbortController<"u"?new AbortController:null,i={definition:e,status:"loading",value:void 0,bytes:0,owners:new Set([t]),promise:null,controller:o,error:null,lastUsed:this.now(),disposed:!1};return i.promise=e.load((o==null?void 0:o.signal)??new AbortController().signal).then(n=>{var c,a;if(i.disposed||this.entries.get(e.key)!==i)throw(c=e.dispose)==null||c.call(e,n),new Error(`Asset "${e.key}" was released before it loaded`);return i.value=n,i.bytes=Math.max(0,Math.round(((a=e.bytes)==null?void 0:a.call(e,n))??0)),i.status="ready",i.promise=null,this.notify(),this.enforceBudget(),n}).catch(n=>{const c=n instanceof Error?n:new Error(String(n));throw this.entries.get(e.key)===i&&!i.disposed&&(i.status="error",i.error=c,i.promise=null,this.notify()),c}),this.entries.set(e.key,i),this.notify(),i.promise}return this.hits+=1,r.owners.add(t),r.lastUsed=this.now(),this.notify(),r.status==="ready"?Promise.resolve(r.value):r.promise}preload(e){const t="__preload__";return this.acquire(e,t).finally(()=>this.release(e.key,t))}release(e,t){var o;const r=this.entries.get(e);!r||!r.owners.delete(t)||(r.lastUsed=this.now(),r.owners.size===0&&r.status==="loading"&&((o=r.controller)==null||o.abort(),r.disposed=!0,this.entries.delete(e)),this.notify(),this.enforceBudget())}get(e){const t=this.entries.get(e);return(t==null?void 0:t.status)==="ready"?t.value:void 0}has(e){return this.entries.has(e)}entry(e){const t=this.entries.get(e);return t?b(e,t):void 0}list(){return Array.from(this.entries,([e,t])=>b(e,t))}setBudget(e){this.budget=e,this.enforceBudget(),this.notify()}evict(e){const t=e??Math.max(0,this.usage()-(Number.isFinite(this.budget)?this.budget:1/0));if(t<=0)return 0;const r=Array.from(this.entries).filter(([,i])=>i.owners.size===0&&i.status==="ready").sort((i,n)=>i[1].lastUsed-n[1].lastUsed);let o=0;for(const[i,n]of r){if(o>=t)break;o+=n.bytes,this.disposeEntry(i,n),this.evictions+=1}return o>0&&this.notify(),o}disposeUnreferenced(){let e=0;for(const[t,r]of Array.from(this.entries))r.owners.size===0&&(e+=r.bytes,this.disposeEntry(t,r));return e>0&&this.notify(),e}disposeAll(){for(const[e,t]of Array.from(this.entries))this.disposeEntry(e,t);this.notify()}getStats(){if(this.statsSnapshot)return this.statsSnapshot;let e=0,t=0,r=0,o=0,i=0;for(const n of this.entries.values())n.owners.size>0&&(e+=1),n.status==="loading"&&(t+=1),n.status==="error"&&(r+=1),n.status==="ready"&&(o+=n.bytes,n.owners.size===0&&(i+=n.bytes));return this.statsSnapshot={assets:this.entries.size,referencedAssets:e,loadingAssets:t,erroredAssets:r,usageBytes:o,reclaimableBytes:i,budgetBytes:this.budget,overBudget:o>this.budget,evictions:this.evictions,hits:this.hits,misses:this.misses},this.statsSnapshot}subscribe(e){return this.listeners.add(e),()=>{this.listeners.delete(e)}}usage(){let e=0;for(const t of this.entries.values())t.status==="ready"&&(e+=t.bytes);return e}enforceBudget(){Number.isFinite(this.budget)&&this.usage()>this.budget&&this.evict()}disposeEntry(e,t){var r,o,i;if(!t.disposed){if(t.disposed=!0,(r=t.controller)==null||r.abort(),t.status==="ready"&&t.value!==void 0)try{(i=(o=t.definition).dispose)==null||i.call(o,t.value)}catch(n){console.warn(`[xr-sdk assets] dispose threw for ${e}`,n)}this.entries.delete(e)}}notify(){this.statsSnapshot=null,this.listeners.forEach(e=>e())}}const b=(s,e)=>({key:s,status:e.status,bytes:e.bytes,owners:e.owners.size,lastUsed:e.lastUsed,error:e.error}),x=s=>new S(s);let y;const M=()=>(y||(y=x()),y);exports.DEFAULT_ASSET_BUDGET_BYTES=A;exports.XRAssetCache=S;exports.createAssetCache=x;exports.getDefaultAssetCache=M;exports.useLiveProps=Q;exports.useXRQuality=U;
@@ -24,4 +24,4 @@ export type ButtonProps = KnownComponentProps & {
24
24
  * `onTap` runs on a tap either way. With neither it is a plain button that does nothing, which the
25
25
  * editor lists as "Not wired yet".
26
26
  */
27
- export declare function Button({ label, action, target, link, onTap, color, visible, className, children, name: _name, locked: _locked, }: ButtonProps): import("react/jsx-runtime").JSX.Element | null;
27
+ export declare function Button(rawProps: ButtonProps): import("react/jsx-runtime").JSX.Element | null;
@@ -259,7 +259,7 @@ export declare const FACE_MIRROR_SETTINGS_FIELDS: [{
259
259
  readonly type: "select";
260
260
  readonly options: {
261
261
  label: string;
262
- value: "flip" | "leftLeft" | "rightRight" | "upsideDown";
262
+ value: "flip" | "upsideDown" | "leftLeft" | "rightRight";
263
263
  }[];
264
264
  }, {
265
265
  readonly min: 0;
@@ -23,4 +23,4 @@ export type LightProps = KnownComponentProps & {
23
23
  rotation?: Partial<Transform3DVector>;
24
24
  showHelper?: boolean;
25
25
  };
26
- export declare function Light({ type, color, intensity, enabled, castShadow, distance, decay, angle, penumbra, position, rotation, showHelper, name: _name, locked: _locked, }: LightProps): import("react/jsx-runtime").JSX.Element;
26
+ export declare function Light(rawProps: LightProps): import("react/jsx-runtime").JSX.Element;
@@ -13,4 +13,4 @@ export type ModelProps = KnownComponentProps & {
13
13
  /** MeshRenderer settings other than the model file; code only. */
14
14
  material?: Partial<MeshRendererSettings["material"]>;
15
15
  };
16
- export declare function Model({ src, position, rotation, scale, visible, material, name: _name, locked: _locked, }: ModelProps): import("react/jsx-runtime").JSX.Element;
16
+ export declare function Model(rawProps: ModelProps): import("react/jsx-runtime").JSX.Element;
@@ -10,4 +10,4 @@ export type Object3DProps = KnownComponentProps & {
10
10
  visible?: boolean;
11
11
  children?: ReactNode;
12
12
  };
13
- export declare function Object3D({ colour, texture, size, visible, children, name: _name, locked: _locked, }: Object3DProps): import("react/jsx-runtime").JSX.Element;
13
+ export declare function Object3D(rawProps: Object3DProps): import("react/jsx-runtime").JSX.Element;
@@ -21,4 +21,4 @@ export type PaintedFaceProps = KnownComponentProps & {
21
21
  * never reads the camera face as a source, so live-face swap and mirror modes
22
22
  * stay with those two in code.
23
23
  */
24
- export declare const PaintedFace: ({ src, amount, layout, ownEyes, ownMouth, visible, }: PaintedFaceProps) => import("react/jsx-runtime").JSX.Element | null;
24
+ export declare const PaintedFace: (rawProps: PaintedFaceProps) => import("react/jsx-runtime").JSX.Element | null;
@@ -1,6 +1,6 @@
1
1
  import { ScreenTextProps } from './types';
2
2
  /** Props the visual editor can show live while a change is unsaved (edit builds only). */
3
- export declare const SCREEN_TEXT_LIVE_EDITABLE: readonly ["text", "color", "fontSize", "screenTransform.position", "screenTransform.size", "screenTransform.rotation"];
3
+ export declare const SCREEN_TEXT_LIVE_EDITABLE: readonly ["text", "color", "fontSize", "textAlign", "screenTransform.position", "screenTransform.size", "screenTransform.rotation"];
4
4
  export declare const isLiveText: (v: unknown) => v is string;
5
5
  /** A `text` override applies only without a `lines` prop, because `lines` wins when both are set. */
6
6
  export declare function useScreenTextEditOverrides(props: ScreenTextProps): ScreenTextProps;