@tomorrowevening/hermes 0.0.117 → 0.0.118

Sign up to get free protection for your applications and to get access to all the features.
package/dist/hermes.es.js CHANGED
@@ -24,87 +24,6 @@ function os(s) {
24
24
  }, r = n(e), a = n(t), o = n(i);
25
25
  return "#" + r + a + o;
26
26
  }
27
- const vo = (s) => {
28
- s?.dispose();
29
- }, ka = (s) => {
30
- s && (Array.isArray(s) ? s.forEach((e) => e.dispose()) : s.dispose());
31
- }, He = (s) => {
32
- if (s) {
33
- for (; s.children.length > 0; ) {
34
- const e = s.children[0];
35
- e.type === "Audio" ? (e.pause(), e.parent && e.parent.remove(e)) : He(e);
36
- }
37
- if (s.parent && s.parent.remove(s), s.isMesh) {
38
- const e = s;
39
- e.geometry?.dispose(), ka(e.material);
40
- }
41
- s.dispose !== void 0 && s.dispose();
42
- }
43
- };
44
- let Di = 0;
45
- const ls = () => {
46
- Di = 0;
47
- }, Ri = (s) => {
48
- if (!s)
49
- return;
50
- let e = s.name.replaceAll(" ", "").replaceAll("/", ".");
51
- if (e.length === 0 && (e = `obj_${Di}`, Di++), s.parent !== null && s.parent.uuid.length > 0 && (e = `${s.parent.uuid}.${e}`), s.uuid = e, s.isMesh !== void 0) {
52
- const t = s;
53
- if (Array.isArray(t.material))
54
- t.material.forEach((i, n) => {
55
- i.uuid = `${e}.material.${n}`;
56
- });
57
- else {
58
- const i = t.material;
59
- i.uuid = `${e}.material`;
60
- }
61
- }
62
- s.children.forEach((t) => Ri(t));
63
- };
64
- class Jt {
65
- static renderer;
66
- static canvas;
67
- static context = null;
68
- static scene = null;
69
- static camera = null;
70
- static material = null;
71
- static inited = !1;
72
- static width = 100;
73
- static height = 100;
74
- static init() {
75
- this.inited || (this.canvas = document.createElement("canvas"), this.canvas.width = this.width, this.canvas.height = this.height, this.context = this.canvas.getContext("2d"), this.inited = !0);
76
- }
77
- static renderToBlob(e) {
78
- this.init();
79
- const t = e.repeat.clone(), i = e.offset.clone();
80
- if (e.repeat.set(1, 1), e.offset.set(0, 0), this.context !== null) {
81
- this.context.clearRect(0, 0, this.width, this.height);
82
- const n = e.image;
83
- if (n != null && n.width > 0) {
84
- this.canvas.title = e.sourceFile;
85
- const r = this.canvas.width / n.width, a = this.renderToCanvas(e);
86
- this.context.drawImage(a, 0, 0, n.width * r, n.height * r);
87
- }
88
- }
89
- return e.repeat.copy(t), e.offset.copy(i), this.canvas.toDataURL("image/png");
90
- }
91
- static renderToCanvas(e) {
92
- if (this.material === null) {
93
- this.camera = new Ai(-0.5, 0.5, 0.5, -0.5, 0, 100), this.scene = new Hs(), this.material = new Je();
94
- const t = new gt();
95
- t.setAttribute("position", new Ke([-0.5, -0.5, 0, 1.5, -0.5, 0, -0.5, 1.5, 0], 3)), t.setAttribute("normal", new Ke([0, 0, 1, 0, 0, 1], 3)), t.setAttribute("uv", new Ke([0, 0, 2, 0, 0, 2], 2));
96
- const i = new O(t, this.material);
97
- this.scene.add(i);
98
- }
99
- if (e.isRenderTargetTexture)
100
- this.material.map = e, this.renderer.render(this.scene, this.camera);
101
- else {
102
- const t = this.renderer.outputColorSpace, i = e.colorSpace;
103
- this.renderer.outputColorSpace = Ut, e.colorSpace = Ut, this.material.map = e, this.renderer.render(this.scene, this.camera), this.renderer.outputColorSpace = t, e.colorSpace = i;
104
- }
105
- return this.renderer.domElement;
106
- }
107
- }
108
27
  function fi(s, e, t, i) {
109
28
  return new (t || (t = Promise))(function(n, r) {
110
29
  function a(l) {
@@ -130,8 +49,8 @@ function fi(s, e, t, i) {
130
49
  c((i = i.apply(s, e || [])).next());
131
50
  });
132
51
  }
133
- const Ua = ["geforce 320m", "geforce 8600", "geforce 8600m gt", "geforce 8800 gs", "geforce 8800 gt", "geforce 9400", "geforce 9400m g", "geforce 9400m", "geforce 9600m gt", "geforce 9600m", "geforce fx go5200", "geforce gt 120", "geforce gt 130", "geforce gt 330m", "geforce gtx 285", "google swiftshader", "intel g41", "intel g45", "intel gma 4500mhd", "intel gma x3100", "intel hd 3000", "intel q45", "legacy", "mali-2", "mali-3", "mali-4", "quadro fx 1500", "quadro fx 4", "quadro fx 5", "radeon hd 2400", "radeon hd 2600", "radeon hd 4670", "radeon hd 4850", "radeon hd 4870", "radeon hd 5670", "radeon hd 5750", "radeon hd 6290", "radeon hd 6300", "radeon hd 6310", "radeon hd 6320", "radeon hd 6490m", "radeon hd 6630m", "radeon hd 6750m", "radeon hd 6770m", "radeon hd 6970m", "sgx 543", "sgx543"];
134
- function cs(s) {
52
+ const ka = ["geforce 320m", "geforce 8600", "geforce 8600m gt", "geforce 8800 gs", "geforce 8800 gt", "geforce 9400", "geforce 9400m g", "geforce 9400m", "geforce 9600m gt", "geforce 9600m", "geforce fx go5200", "geforce gt 120", "geforce gt 130", "geforce gt 330m", "geforce gtx 285", "google swiftshader", "intel g41", "intel g45", "intel gma 4500mhd", "intel gma x3100", "intel hd 3000", "intel q45", "legacy", "mali-2", "mali-3", "mali-4", "quadro fx 1500", "quadro fx 4", "quadro fx 5", "radeon hd 2400", "radeon hd 2600", "radeon hd 4670", "radeon hd 4850", "radeon hd 4870", "radeon hd 5670", "radeon hd 5750", "radeon hd 6290", "radeon hd 6300", "radeon hd 6310", "radeon hd 6320", "radeon hd 6490m", "radeon hd 6630m", "radeon hd 6750m", "radeon hd 6770m", "radeon hd 6970m", "sgx 543", "sgx543"];
53
+ function ls(s) {
135
54
  return s = s.toLowerCase().replace(/.*angle ?\((.+)\)(?: on vulkan [0-9.]+)?$/i, "$1").replace(/\s(\d{1,2}gb|direct3d.+$)|\(r\)| \([^)]+\)$/g, "").replace(/(?:vulkan|opengl) \d+\.\d+(?:\.\d+)?(?: \((.*)\))?/, "$1");
136
55
  }
137
56
  const pn = typeof window > "u", Le = (() => {
@@ -140,7 +59,7 @@ const pn = typeof window > "u", Le = (() => {
140
59
  const { userAgent: s, platform: e, maxTouchPoints: t } = window.navigator, i = /(iphone|ipod|ipad)/i.test(s), n = e === "iPad" || e === "MacIntel" && t > 0 && !window.MSStream;
141
60
  return { isIpad: n, isMobile: /android/i.test(s) || i || n, isSafari12: /Version\/12.+Safari/.test(s), isFirefox: /Firefox/.test(s) };
142
61
  })();
143
- function ja(s, e, t) {
62
+ function Ua(s, e, t) {
144
63
  if (!t)
145
64
  return [e];
146
65
  const i = function(l) {
@@ -175,13 +94,13 @@ function ja(s, e, t) {
175
94
  let c;
176
95
  return i === "80162181255" ? c = o.filter(([, , l]) => l >= 14) : (c = o.filter(([, l]) => l === i), c.length || (c = o)), c.map(([l]) => `apple ${l} gpu`);
177
96
  }
178
- class hs extends Error {
97
+ class cs extends Error {
179
98
  constructor(e) {
180
99
  super(e), Object.setPrototypeOf(this, new.target.prototype);
181
100
  }
182
101
  }
183
- const gi = [], ds = [];
184
- function Na(s, e) {
102
+ const gi = [], hs = [];
103
+ function ja(s, e) {
185
104
  if (s === e)
186
105
  return 0;
187
106
  const t = s;
@@ -196,30 +115,30 @@ function Na(s, e) {
196
115
  return n;
197
116
  let o, c, l = 0, d = 0, p = 0;
198
117
  for (; d < i; )
199
- ds[d] = s.charCodeAt(a + d), gi[d] = ++d;
118
+ hs[d] = s.charCodeAt(a + d), gi[d] = ++d;
200
119
  for (; p < n; )
201
120
  for (r = e.charCodeAt(a + p), o = p++, l = p, d = 0; d < i; d++)
202
- c = r === ds[d] ? o : o + 1, o = gi[d], l = gi[d] = o > l ? c > l ? l + 1 : c : c > o ? o + 1 : c;
121
+ c = r === hs[d] ? o : o + 1, o = gi[d], l = gi[d] = o > l ? c > l ? l + 1 : c : c > o ? o + 1 : c;
203
122
  return l;
204
123
  }
205
- function Fa(s) {
124
+ function Na(s) {
206
125
  return s != null;
207
126
  }
208
- const za = ({ mobileTiers: s = [0, 15, 30, 60], desktopTiers: e = [0, 15, 30, 60], override: t = {}, glContext: i, failIfMajorPerformanceCaveat: n = !1, benchmarksURL: r = "https://unpkg.com/detect-gpu@5.0.57/dist/benchmarks" } = {}) => fi(void 0, void 0, void 0, function* () {
127
+ const Fa = ({ mobileTiers: s = [0, 15, 30, 60], desktopTiers: e = [0, 15, 30, 60], override: t = {}, glContext: i, failIfMajorPerformanceCaveat: n = !1, benchmarksURL: r = "https://unpkg.com/detect-gpu@5.0.57/dist/benchmarks" } = {}) => fi(void 0, void 0, void 0, function* () {
209
128
  const a = {};
210
129
  if (pn)
211
130
  return { tier: 0, type: "SSR" };
212
131
  const { isIpad: o = !!Le?.isIpad, isMobile: c = !!Le?.isMobile, screenSize: l = window.screen, loadBenchmarks: d = (C) => fi(void 0, void 0, void 0, function* () {
213
132
  const w = yield fetch(`${r}/${C}`).then((I) => I.json());
214
133
  if (parseInt(w.shift().split(".")[0], 10) < 4)
215
- throw new hs("Detect GPU benchmark data is out of date. Please update to version 4x");
134
+ throw new cs("Detect GPU benchmark data is out of date. Please update to version 4x");
216
135
  return w;
217
136
  }) } = t;
218
137
  let { renderer: p } = t;
219
138
  const m = (C, w, I, U, K) => ({ device: K, fps: U, gpu: I, isMobile: c, tier: C, type: w });
220
139
  let g, S = "";
221
140
  if (p)
222
- p = cs(p), g = [p];
141
+ p = ls(p), g = [p];
223
142
  else {
224
143
  const C = i || function(I, U = !1) {
225
144
  const K = { alpha: !1, antialias: !1, depth: !1, failIfMajorPerformanceCaveat: U, powerPreference: "high-performance", stencil: !1 };
@@ -232,8 +151,8 @@ const za = ({ mobileTiers: s = [0, 15, 30, 60], desktopTiers: e = [0, 15, 30, 60
232
151
  const w = Le?.isFirefox ? null : C.getExtension("WEBGL_debug_renderer_info");
233
152
  if (p = w ? C.getParameter(w.UNMASKED_RENDERER_WEBGL) : C.getParameter(C.RENDERER), !p)
234
153
  return m(1, "FALLBACK");
235
- S = p, p = cs(p), g = function(I, U, K) {
236
- return U === "apple gpu" ? ja(I, U, K) : [U];
154
+ S = p, p = ls(p), g = function(I, U, K) {
155
+ return U === "apple gpu" ? Ua(I, U, K) : [U];
237
156
  }(C, p, c);
238
157
  }
239
158
  const T = (yield Promise.all(g.map(function(C) {
@@ -252,7 +171,7 @@ const za = ({ mobileTiers: s = [0, 15, 30, 60], desktopTiers: e = [0, 15, 30, 60
252
171
  try {
253
172
  me = yield K;
254
173
  } catch (V) {
255
- if (V instanceof hs)
174
+ if (V instanceof cs)
256
175
  throw V;
257
176
  return;
258
177
  }
@@ -267,7 +186,7 @@ const za = ({ mobileTiers: s = [0, 15, 30, 60], desktopTiers: e = [0, 15, 30, 60
267
186
  if (le === 0)
268
187
  return;
269
188
  const Q = C.split(/[.,()\[\]/\s]/g).sort().filter((V, re, Oe) => re === 0 || V !== Oe[re - 1]).join(" ");
270
- let G, [Ue, , , , ce] = le > 1 ? Ce.map((V) => [V, Na(Q, V[2])]).sort(([, V], [, re]) => V - re)[0][0] : Ce[0], be = Number.MAX_VALUE;
189
+ let G, [Ue, , , , ce] = le > 1 ? Ce.map((V) => [V, ja(Q, V[2])]).sort(([, V], [, re]) => V - re)[0][0] : Ce[0], be = Number.MAX_VALUE;
271
190
  const { devicePixelRatio: te } = window, je = l.width * te * l.height * te;
272
191
  for (const V of ce) {
273
192
  const [re, Oe] = V, vt = re * Oe, it = Math.abs(je - vt);
@@ -278,9 +197,9 @@ const za = ({ mobileTiers: s = [0, 15, 30, 60], desktopTiers: e = [0, 15, 30, 60
278
197
  const [, , Ne, Fe] = G;
279
198
  return [be, Ne, Ue, Fe];
280
199
  });
281
- }))).filter(Fa).sort(([C = Number.MAX_VALUE, w], [I = Number.MAX_VALUE, U]) => C === I ? w - U : C - I);
200
+ }))).filter(Na).sort(([C = Number.MAX_VALUE, w], [I = Number.MAX_VALUE, U]) => C === I ? w - U : C - I);
282
201
  if (!T.length) {
283
- const C = Ua.find((w) => p.includes(w));
202
+ const C = ka.find((w) => p.includes(w));
284
203
  return C ? m(0, "BLOCKLISTED", C) : m(1, "FALLBACK", `${p} (${S})`);
285
204
  }
286
205
  const [, M, f, v] = T[0];
@@ -292,10 +211,10 @@ const za = ({ mobileTiers: s = [0, 15, 30, 60], desktopTiers: e = [0, 15, 30, 60
292
211
  M >= E[C] && (b = C);
293
212
  return m(b, "BENCHMARK", f, M, v);
294
213
  });
295
- var Ha = /* @__PURE__ */ ((s) => (s[s.High = 0] = "High", s[s.Medium = 1] = "Medium", s[s.Low = 2] = "Low", s))(Ha || {});
296
- function yo(s) {
214
+ var za = /* @__PURE__ */ ((s) => (s[s.High = 0] = "High", s[s.Medium = 1] = "Medium", s[s.Low = 2] = "Low", s))(za || {});
215
+ function vo(s) {
297
216
  return new Promise((e) => {
298
- za().then((t) => {
217
+ Fa().then((t) => {
299
218
  let i = !1;
300
219
  const n = /^((?!chrome|android).)*safari/i.test(navigator.userAgent);
301
220
  if (i = "transferControlToOffscreen" in s, n) {
@@ -316,7 +235,104 @@ function yo(s) {
316
235
  });
317
236
  });
318
237
  }
319
- class bo {
238
+ function $e(s, e, t) {
239
+ return Math.min(e, Math.max(s, t));
240
+ }
241
+ function ds(s, e, t) {
242
+ return (t - s) / (e - s);
243
+ }
244
+ function Di(s, e, t) {
245
+ return s * (1 - t) + e * t;
246
+ }
247
+ function yo(s, e) {
248
+ const t = s - e;
249
+ return Math.sqrt(t * t);
250
+ }
251
+ function Me(s, e = 1) {
252
+ return Number(s.toFixed(e));
253
+ }
254
+ const bo = (s) => {
255
+ s?.dispose();
256
+ }, Ha = (s) => {
257
+ s && (Array.isArray(s) ? s.forEach((e) => e.dispose()) : s.dispose());
258
+ }, He = (s) => {
259
+ if (s) {
260
+ for (; s.children.length > 0; ) {
261
+ const e = s.children[0];
262
+ e.type === "Audio" ? (e.pause(), e.parent && e.parent.remove(e)) : He(e);
263
+ }
264
+ if (s.parent && s.parent.remove(s), s.isMesh) {
265
+ const e = s;
266
+ e.geometry?.dispose(), Ha(e.material);
267
+ }
268
+ s.dispose !== void 0 && s.dispose();
269
+ }
270
+ };
271
+ let Ri = 0;
272
+ const us = () => {
273
+ Ri = 0;
274
+ }, Ii = (s) => {
275
+ if (!s)
276
+ return;
277
+ let e = s.name.replaceAll(" ", "").replaceAll("/", ".");
278
+ if (e.length === 0 && (e = `obj_${Ri}`, Ri++), s.parent !== null && s.parent.uuid.length > 0 && (e = `${s.parent.uuid}.${e}`), s.uuid = e, s.isMesh !== void 0) {
279
+ const t = s;
280
+ if (Array.isArray(t.material))
281
+ t.material.forEach((i, n) => {
282
+ i.uuid = `${e}.material.${n}`;
283
+ });
284
+ else {
285
+ const i = t.material;
286
+ i.uuid = `${e}.material`;
287
+ }
288
+ }
289
+ s.children.forEach((t) => Ii(t));
290
+ };
291
+ class Jt {
292
+ static renderer;
293
+ static canvas;
294
+ static context = null;
295
+ static scene = null;
296
+ static camera = null;
297
+ static material = null;
298
+ static inited = !1;
299
+ static width = 100;
300
+ static height = 100;
301
+ static init() {
302
+ this.inited || (this.canvas = document.createElement("canvas"), this.canvas.width = this.width, this.canvas.height = this.height, this.context = this.canvas.getContext("2d"), this.inited = !0);
303
+ }
304
+ static renderToBlob(e) {
305
+ this.init();
306
+ const t = e.repeat.clone(), i = e.offset.clone();
307
+ if (e.repeat.set(1, 1), e.offset.set(0, 0), this.context !== null) {
308
+ this.context.clearRect(0, 0, this.width, this.height);
309
+ const n = e.image;
310
+ if (n != null && n.width > 0) {
311
+ this.canvas.title = e.sourceFile;
312
+ const r = this.canvas.width / n.width, a = this.renderToCanvas(e);
313
+ this.context.drawImage(a, 0, 0, n.width * r, n.height * r);
314
+ }
315
+ }
316
+ return e.repeat.copy(t), e.offset.copy(i), this.canvas.toDataURL("image/png");
317
+ }
318
+ static renderToCanvas(e) {
319
+ if (this.material === null) {
320
+ this.camera = new Ai(-0.5, 0.5, 0.5, -0.5, 0, 100), this.scene = new Hs(), this.material = new Je();
321
+ const t = new gt();
322
+ t.setAttribute("position", new Ke([-0.5, -0.5, 0, 1.5, -0.5, 0, -0.5, 1.5, 0], 3)), t.setAttribute("normal", new Ke([0, 0, 1, 0, 0, 1], 3)), t.setAttribute("uv", new Ke([0, 0, 2, 0, 0, 2], 2));
323
+ const i = new O(t, this.material);
324
+ this.scene.add(i);
325
+ }
326
+ if (e.isRenderTargetTexture)
327
+ this.material.map = e, this.renderer.render(this.scene, this.camera);
328
+ else {
329
+ const t = this.renderer.outputColorSpace, i = e.colorSpace;
330
+ this.renderer.outputColorSpace = Ut, e.colorSpace = Ut, this.material.map = e, this.renderer.render(this.scene, this.camera), this.renderer.outputColorSpace = t, e.colorSpace = i;
331
+ }
332
+ return this.renderer.domElement;
333
+ }
334
+ }
335
+ class Eo {
320
336
  components = /* @__PURE__ */ new Map();
321
337
  listen;
322
338
  // Protected
@@ -388,7 +404,7 @@ class zi {
388
404
  handleEditor(e, t, i) {
389
405
  }
390
406
  }
391
- class Eo extends zi {
407
+ class Co extends zi {
392
408
  selectDropdown(e, t) {
393
409
  this.app.send({
394
410
  event: "selectComponent",
@@ -420,7 +436,7 @@ class Eo extends zi {
420
436
  }
421
437
  }
422
438
  }
423
- function Co(s, e, t) {
439
+ function So(s, e, t) {
424
440
  if (s.editor) {
425
441
  t.ui.restore(), t.onSelectionChange((a) => {
426
442
  a.length < 1 || a.forEach((o) => {
@@ -463,7 +479,7 @@ function Co(s, e, t) {
463
479
  } else
464
480
  t.ui.hide();
465
481
  }
466
- function So() {
482
+ function wo() {
467
483
  setTimeout(() => {
468
484
  const s = document.getElementById("theatrejs-studio-root");
469
485
  if (s === null || s.shadowRoot === null)
@@ -489,7 +505,7 @@ function So() {
489
505
  }
490
506
  }, 1e3);
491
507
  }
492
- class wo extends zi {
508
+ class xo extends zi {
493
509
  project;
494
510
  sheets = /* @__PURE__ */ new Map();
495
511
  sheetObjects = /* @__PURE__ */ new Map();
@@ -898,19 +914,7 @@ function mn(s) {
898
914
  }, i.onerror = t, i.src = s;
899
915
  });
900
916
  }
901
- function $e(s, e, t) {
902
- return Math.min(e, Math.max(s, t));
903
- }
904
- function us(s, e, t) {
905
- return (t - s) / (e - s);
906
- }
907
- function Ii(s, e, t) {
908
- return s * (1 - t) + e * t;
909
- }
910
- function Me(s, e = 1) {
911
- return Number(s.toFixed(e));
912
- }
913
- class xo extends zi {
917
+ class Oo extends zi {
914
918
  canvas = null;
915
919
  // Canvas or OffscreenCanvas
916
920
  inputElement = null;
@@ -1055,7 +1059,7 @@ class xo extends zi {
1055
1059
  addScene(e) {
1056
1060
  if (e === void 0 || (this.scenes.set(e.name, e), !this.app.debugEnabled))
1057
1061
  return;
1058
- ls(), Ri(e);
1062
+ us(), Ii(e);
1059
1063
  const t = ut(e);
1060
1064
  this.app.send({
1061
1065
  event: "addScene",
@@ -1098,7 +1102,7 @@ class xo extends zi {
1098
1102
  setScene(e) {
1099
1103
  if (e === void 0 || (this.scene = e, !this.app.debugEnabled))
1100
1104
  return;
1101
- this.renderer !== void 0 && (Jt.renderer = this.renderer), ls(), Ri(e);
1105
+ this.renderer !== void 0 && (Jt.renderer = this.renderer), us(), Ii(e);
1102
1106
  const t = ut(e);
1103
1107
  this.app.send({
1104
1108
  event: "setScene",
@@ -1954,7 +1958,7 @@ function er(s) {
1954
1958
  }
1955
1959
  return /* @__PURE__ */ u.jsx("li", { className: t === e.title ? "selected" : "", children: n }, Ia());
1956
1960
  }
1957
- function Oo(s, e, t) {
1961
+ function To(s, e, t) {
1958
1962
  function i(r) {
1959
1963
  switch (e.forEach((a) => {
1960
1964
  a.callback(s, a.remote, r);
@@ -2142,7 +2146,7 @@ function Qe(s) {
2142
2146
  "input",
2143
2147
  {
2144
2148
  type: "text",
2145
- value: s.value.toString(),
2149
+ value: i.toString(),
2146
2150
  disabled: s.disabled,
2147
2151
  ref: e,
2148
2152
  className: "min",
@@ -2159,7 +2163,7 @@ function Qe(s) {
2159
2163
  {
2160
2164
  disabled: s.disabled,
2161
2165
  type: "range",
2162
- value: s.value,
2166
+ value: i,
2163
2167
  min: s.min,
2164
2168
  max: s.max,
2165
2169
  step: s.step,
@@ -2182,7 +2186,7 @@ function ir(s) {
2182
2186
  window.removeEventListener("mousemove", T), window.removeEventListener("mouseup", S), m(!1);
2183
2187
  }
2184
2188
  function T(b) {
2185
- const C = r.current.getBoundingClientRect(), w = $e(0, 99, b.clientX - C.left) / 99, I = $e(0, 99, b.clientY - C.top) / 99, U = Me(Ii(l.min, l.max, w), 3), K = Me(Ii(l.min, l.max, I), 3);
2189
+ const C = r.current.getBoundingClientRect(), w = $e(0, 99, b.clientX - C.left) / 99, I = $e(0, 99, b.clientY - C.top) / 99, U = Me(Di(l.min, l.max, w), 3), K = Me(Di(l.min, l.max, I), 3);
2186
2190
  s.onChange({ target: { value: { x: U, y: K } } }), c({ x: U, y: K });
2187
2191
  }
2188
2192
  function M(b) {
@@ -2198,7 +2202,7 @@ function ir(s) {
2198
2202
  d({ min: l.min, max: b }), (o.x > b || o.y > b) && c({ x: $e(l.min, b, o.x), y: $e(l.min, b, o.y) });
2199
2203
  }
2200
2204
  tt(() => {
2201
- const b = us(l.min, l.max, o.x), C = us(l.min, l.max, o.y);
2205
+ const b = ds(l.min, l.max, o.x), C = ds(l.min, l.max, o.y);
2202
2206
  a.current.style.left = `${b * 100}%`, a.current.style.top = `${C * 100}%`;
2203
2207
  }, [l, o]);
2204
2208
  const E = s.step !== void 0 ? s.step : 0.01;
@@ -7357,7 +7361,7 @@ class pe extends jt {
7357
7361
  n.start(), this.selectedItem.getWorldPosition(e.target0);
7358
7362
  const r = () => {
7359
7363
  const a = n.getDelta();
7360
- this.cameraControls && this.cameraControls.update(a), t && (e.target.lerp(e.target0, i), e.object.position.lerp(e.position0, i), e.object.zoom = Ii(e.object.zoom, e.zoom0, i), e.object.updateProjectionMatrix(), e.dispatchEvent({ type: "change" })), n.getElapsedTime() >= 0.5 ? (cancelAnimationFrame(this.cameraControlsRafID), this.cameraControlsRafID = -1, this.clearControls()) : this.cameraControlsRafID = requestAnimationFrame(r);
7364
+ this.cameraControls && this.cameraControls.update(a), t && (e.target.lerp(e.target0, i), e.object.position.lerp(e.position0, i), e.object.zoom = Di(e.object.zoom, e.zoom0, i), e.object.updateProjectionMatrix(), e.dispatchEvent({ type: "change" })), n.getElapsedTime() >= 0.5 ? (cancelAnimationFrame(this.cameraControlsRafID), this.cameraControlsRafID = -1, this.clearControls()) : this.cameraControlsRafID = requestAnimationFrame(r);
7361
7365
  };
7362
7366
  r();
7363
7367
  };
@@ -7968,7 +7972,7 @@ class ho extends jt {
7968
7972
  }
7969
7973
  }
7970
7974
  function uo(s) {
7971
- const [e] = B([]), [t] = B([]), [i, n] = B(0), r = (d) => {
7975
+ const [e] = B([]), [t] = B([]), [i, n] = B(0), [r, a] = B(0), o = (d) => {
7972
7976
  const p = d.value;
7973
7977
  e.push(p), t.push(
7974
7978
  /* @__PURE__ */ u.jsx(
@@ -7985,7 +7989,7 @@ function uo(s) {
7985
7989
  Math.random()
7986
7990
  )
7987
7991
  ), n(Date.now());
7988
- }, a = (d) => {
7992
+ }, c = (d) => {
7989
7993
  const p = d.value;
7990
7994
  for (let m = 0; m < e.length; m++)
7991
7995
  if (p.uuid === e[m].uuid) {
@@ -8004,7 +8008,7 @@ function uo(s) {
8004
8008
  ), n(Date.now());
8005
8009
  return;
8006
8010
  }
8007
- }, o = (d) => {
8011
+ }, l = (d) => {
8008
8012
  const p = d.value;
8009
8013
  for (let m = 0; m < e.length; m++)
8010
8014
  if (p.uuid === e[m].uuid) {
@@ -8012,11 +8016,9 @@ function uo(s) {
8012
8016
  return;
8013
8017
  }
8014
8018
  };
8015
- tt(() => (D.addEventListener(P.ADD_SCENE, r), D.addEventListener(P.REFRESH_SCENE, a), D.addEventListener(P.REMOVE_SCENE, o), () => {
8016
- D.removeEventListener(P.ADD_SCENE, r), D.removeEventListener(P.REFRESH_SCENE, a), D.removeEventListener(P.REMOVE_SCENE, o);
8017
- }), []);
8018
- const [c, l] = B(0);
8019
- return /* @__PURE__ */ u.jsxs("div", { id: "SidePanel", children: [
8019
+ return tt(() => (D.addEventListener(P.ADD_SCENE, o), D.addEventListener(P.REFRESH_SCENE, c), D.addEventListener(P.REMOVE_SCENE, l), () => {
8020
+ D.removeEventListener(P.ADD_SCENE, o), D.removeEventListener(P.REFRESH_SCENE, c), D.removeEventListener(P.REMOVE_SCENE, l);
8021
+ }), []), /* @__PURE__ */ u.jsxs("div", { id: "SidePanel", children: [
8020
8022
  /* @__PURE__ */ u.jsx("div", { className: "scenes", children: t }, i),
8021
8023
  /* @__PURE__ */ u.jsx(co, { three: s.three }),
8022
8024
  /* @__PURE__ */ u.jsx(ho, { three: s.three }),
@@ -8025,16 +8027,16 @@ function uo(s) {
8025
8027
  "input",
8026
8028
  {
8027
8029
  type: "number",
8028
- value: c,
8030
+ value: r,
8029
8031
  onChange: (d) => {
8030
8032
  const p = d.target.value;
8031
- console.log(`Value: ${p}, Length: ${p.length}, #${Number(p)}`), l(p);
8033
+ a(p);
8032
8034
  }
8033
8035
  }
8034
8036
  )
8035
8037
  ] });
8036
8038
  }
8037
- function To(s) {
8039
+ function Mo(s) {
8038
8040
  return tt(() => {
8039
8041
  function e(o) {
8040
8042
  let c = null;
@@ -8100,7 +8102,7 @@ function po(s) {
8100
8102
  /* @__PURE__ */ u.jsx("div", { className: "footer", children: s.footer })
8101
8103
  ] });
8102
8104
  }
8103
- function Mo(s) {
8105
+ function Ao(s) {
8104
8106
  return /* @__PURE__ */ u.jsx(po, { children: /* @__PURE__ */ u.jsxs(u.Fragment, { children: [
8105
8107
  /* @__PURE__ */ u.jsx(
8106
8108
  pe,
@@ -8117,7 +8119,7 @@ function Mo(s) {
8117
8119
  }
8118
8120
  export {
8119
8121
  ni as Accordion,
8120
- bo as Application,
8122
+ Eo as Application,
8121
8123
  zi as BaseRemote,
8122
8124
  gn as ChildObject,
8123
8125
  fs as ContainerObject,
@@ -8130,33 +8132,38 @@ export {
8130
8132
  co as Inspector,
8131
8133
  pe as MultiView,
8132
8134
  fn as NavButton,
8133
- Ha as QualityType,
8134
- Eo as RemoteComponents,
8135
- Oo as RemoteController,
8136
- wo as RemoteTheatre,
8137
- xo as RemoteThree,
8138
- To as SceneInspector,
8135
+ za as QualityType,
8136
+ Co as RemoteComponents,
8137
+ To as RemoteController,
8138
+ xo as RemoteTheatre,
8139
+ Oo as RemoteThree,
8140
+ Mo as SceneInspector,
8139
8141
  uo as SidePanel,
8140
8142
  Ns as Spline,
8141
8143
  no as SplineEditor,
8142
- Mo as ThreeEditor,
8144
+ Ao as ThreeEditor,
8143
8145
  P as ToolEvents,
8144
8146
  ge as Transform,
8145
8147
  si as capitalize,
8148
+ $e as clamp,
8146
8149
  os as colorToHex,
8147
8150
  Ra as copyToClipboard,
8148
- So as customizeTheatreElements,
8151
+ wo as customizeTheatreElements,
8149
8152
  D as debugDispatcher,
8150
8153
  _o as defaultTheatreCallback,
8151
- yo as detectSettings,
8154
+ vo as detectSettings,
8152
8155
  He as dispose,
8153
- ka as disposeMaterial,
8154
- vo as disposeTexture,
8155
- Ri as hierarchyUUID,
8156
+ Ha as disposeMaterial,
8157
+ bo as disposeTexture,
8158
+ yo as distance,
8159
+ Ii as hierarchyUUID,
8156
8160
  La as isColor,
8161
+ Di as mix,
8157
8162
  un as noop,
8163
+ ds as normalize,
8158
8164
  Ia as randomID,
8159
- ls as resetThreeObjects,
8160
- Co as theatreEditorApp,
8161
- Di as totalThreeObjects
8165
+ us as resetThreeObjects,
8166
+ Me as round,
8167
+ So as theatreEditorApp,
8168
+ Ri as totalThreeObjects
8162
8169
  };
package/package.json CHANGED
@@ -7,7 +7,7 @@
7
7
  "module": "./dist/hermes.esm.js",
8
8
  "types": "./types/index.d.ts",
9
9
  "type": "module",
10
- "version": "0.0.117",
10
+ "version": "0.0.118",
11
11
  "homepage": "https://github.com/tomorrowevening/hermes#readme",
12
12
  "bugs": {
13
13
  "url": "https://github.com/tomorrowevening/hermes/issues"
package/types/index.d.ts CHANGED
@@ -1,29 +1,30 @@
1
- export * from './core/types';
2
- export * from './editor/utils';
3
- export * from './utils/three';
4
- export * from './utils/detectSettings';
5
- export { default as Application } from './core/Application';
6
- export { debugDispatcher, ToolEvents } from './editor/global';
7
- export { default as BaseRemote } from './core/remote/BaseRemote';
8
- export { default as RemoteComponents } from './core/remote/RemoteComponents';
9
- export * from './editor/theatreUtils';
10
- export { default as RemoteTheatre } from './core/remote/RemoteTheatre';
11
- export { default as RemoteThree } from './core/remote/RemoteThree';
12
- export { default as NavButton } from './editor/components/NavButton';
13
- export { default as DraggableItem } from './editor/components/DraggableItem';
14
- export { default as Draggable } from './editor/components/Draggable';
15
- export { default as DropdownItem } from './editor/components/DropdownItem';
16
- export { default as Dropdown } from './editor/components/Dropdown';
17
- export { default as RemoteController } from './core/RemoteController';
18
- export { default as SidePanel } from './editor/sidePanel/SidePanel';
19
- export { default as Accordion } from './editor/sidePanel/Accordion';
20
- export { default as ChildObject } from './editor/sidePanel/ChildObject';
21
- export { default as ContainerObject } from './editor/sidePanel/ContainerObject';
22
- export { default as Inspector } from './editor/sidePanel/inspector/Inspector';
23
- export { default as SceneInspector } from './editor/sidePanel/inspector/SceneInspector';
24
- export { default as MultiView } from './editor/multiView/MultiView';
25
- export { default as Editor } from './editor/Editor';
26
- export { default as ThreeEditor } from './editor/ThreeEditor';
27
- export { default as Transform } from './editor/tools/Transform';
28
- export { default as Spline } from './editor/tools/splineEditor/Spline';
29
- export { default as SplineEditor } from './editor/tools/splineEditor/index';
1
+ export * from './core/types';
2
+ export * from './editor/utils';
3
+ export * from './utils/detectSettings';
4
+ export * from './utils/math';
5
+ export * from './utils/three';
6
+ export { default as Application } from './core/Application';
7
+ export { debugDispatcher, ToolEvents } from './editor/global';
8
+ export { default as BaseRemote } from './core/remote/BaseRemote';
9
+ export { default as RemoteComponents } from './core/remote/RemoteComponents';
10
+ export * from './editor/theatreUtils';
11
+ export { default as RemoteTheatre } from './core/remote/RemoteTheatre';
12
+ export { default as RemoteThree } from './core/remote/RemoteThree';
13
+ export { default as NavButton } from './editor/components/NavButton';
14
+ export { default as DraggableItem } from './editor/components/DraggableItem';
15
+ export { default as Draggable } from './editor/components/Draggable';
16
+ export { default as DropdownItem } from './editor/components/DropdownItem';
17
+ export { default as Dropdown } from './editor/components/Dropdown';
18
+ export { default as RemoteController } from './core/RemoteController';
19
+ export { default as SidePanel } from './editor/sidePanel/SidePanel';
20
+ export { default as Accordion } from './editor/sidePanel/Accordion';
21
+ export { default as ChildObject } from './editor/sidePanel/ChildObject';
22
+ export { default as ContainerObject } from './editor/sidePanel/ContainerObject';
23
+ export { default as Inspector } from './editor/sidePanel/inspector/Inspector';
24
+ export { default as SceneInspector } from './editor/sidePanel/inspector/SceneInspector';
25
+ export { default as MultiView } from './editor/multiView/MultiView';
26
+ export { default as Editor } from './editor/Editor';
27
+ export { default as ThreeEditor } from './editor/ThreeEditor';
28
+ export { default as Transform } from './editor/tools/Transform';
29
+ export { default as Spline } from './editor/tools/splineEditor/Spline';
30
+ export { default as SplineEditor } from './editor/tools/splineEditor/index';