@tomorrowevening/hermes 0.0.121 → 0.0.123

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/hermes.es.js CHANGED
@@ -415,7 +415,10 @@ class xo {
415
415
  this.targets[e.id]?.handleEvent(e.data);
416
416
  }
417
417
  }
418
- class Oo {
418
+ function Oo() {
419
+ return new Worker(new URL("/assets/LoadWorker-5918cc62.js", self.location), { type: "module" });
420
+ }
421
+ class To {
419
422
  components = /* @__PURE__ */ new Map();
420
423
  listen;
421
424
  // Protected
@@ -487,7 +490,7 @@ class Bi {
487
490
  handleEditor(e, t, i) {
488
491
  }
489
492
  }
490
- class To extends Bi {
493
+ class Mo extends Bi {
491
494
  selectDropdown(e, t) {
492
495
  this.app.send({
493
496
  event: "selectComponent",
@@ -519,7 +522,7 @@ class To extends Bi {
519
522
  }
520
523
  }
521
524
  }
522
- function Mo(s, e, t) {
525
+ function Ao(s, e, t) {
523
526
  if (s.editor) {
524
527
  t.ui.restore(), t.onSelectionChange((a) => {
525
528
  a.length < 1 || a.forEach((o) => {
@@ -562,7 +565,7 @@ function Mo(s, e, t) {
562
565
  } else
563
566
  t.ui.hide();
564
567
  }
565
- function Ao() {
568
+ function Po() {
566
569
  setTimeout(() => {
567
570
  const s = document.getElementById("theatrejs-studio-root");
568
571
  if (s === null || s.shadowRoot === null)
@@ -588,7 +591,7 @@ function Ao() {
588
591
  }
589
592
  }, 1e3);
590
593
  }
591
- class Po extends Bi {
594
+ class Do extends Bi {
592
595
  project;
593
596
  sheets = /* @__PURE__ */ new Map();
594
597
  sheetObjects = /* @__PURE__ */ new Map();
@@ -997,7 +1000,7 @@ function fn(s) {
997
1000
  }, i.onerror = t, i.src = s;
998
1001
  });
999
1002
  }
1000
- class Do extends Bi {
1003
+ class Ro extends Bi {
1001
1004
  canvas = null;
1002
1005
  // Canvas or OffscreenCanvas
1003
1006
  inputElement = null;
@@ -2041,7 +2044,7 @@ function nr(s) {
2041
2044
  }
2042
2045
  return /* @__PURE__ */ u.jsx("li", { className: t === e.title ? "selected" : "", children: n }, Ua());
2043
2046
  }
2044
- function Ro(s, e, t) {
2047
+ function Io(s, e, t) {
2045
2048
  function i(r) {
2046
2049
  switch (e.forEach((a) => {
2047
2050
  a.callback(s, a.remote, r);
@@ -8154,7 +8157,7 @@ function fo(s) {
8154
8157
  /* @__PURE__ */ u.jsx(ae, { three: s.three })
8155
8158
  ] });
8156
8159
  }
8157
- function Io(s) {
8160
+ function Lo(s) {
8158
8161
  return tt(() => {
8159
8162
  function e(o) {
8160
8163
  let c = null;
@@ -8220,7 +8223,7 @@ function go(s) {
8220
8223
  /* @__PURE__ */ u.jsx("div", { className: "footer", children: s.footer })
8221
8224
  ] });
8222
8225
  }
8223
- function Lo(s) {
8226
+ function ko(s) {
8224
8227
  return /* @__PURE__ */ u.jsx(go, { children: /* @__PURE__ */ u.jsxs(u.Fragment, { children: [
8225
8228
  /* @__PURE__ */ u.jsx(
8226
8229
  me,
@@ -8237,10 +8240,11 @@ function Lo(s) {
8237
8240
  }
8238
8241
  export {
8239
8242
  ri as Accordion,
8240
- Oo as Application,
8243
+ To as Application,
8241
8244
  Bi as BaseRemote,
8242
8245
  _n as ChildObject,
8243
8246
  vs as ContainerObject,
8247
+ Oo as CreateLoadWorker,
8244
8248
  ir as Draggable,
8245
8249
  tr as DraggableItem,
8246
8250
  sr as Dropdown,
@@ -8253,22 +8257,22 @@ export {
8253
8257
  gn as NavButton,
8254
8258
  xo as ProxyManager,
8255
8259
  Ba as QualityType,
8256
- To as RemoteComponents,
8257
- Ro as RemoteController,
8258
- Po as RemoteTheatre,
8259
- Do as RemoteThree,
8260
- Io as SceneInspector,
8260
+ Mo as RemoteComponents,
8261
+ Io as RemoteController,
8262
+ Do as RemoteTheatre,
8263
+ Ro as RemoteThree,
8264
+ Lo as SceneInspector,
8261
8265
  fo as SidePanel,
8262
8266
  Hs as Spline,
8263
8267
  oo as SplineEditor,
8264
- Lo as ThreeEditor,
8268
+ ko as ThreeEditor,
8265
8269
  P as ToolEvents,
8266
8270
  ge as Transform,
8267
8271
  ai as capitalize,
8268
8272
  $e as clamp,
8269
8273
  hs as colorToHex,
8270
8274
  ka as copyToClipboard,
8271
- Ao as customizeTheatreElements,
8275
+ Po as customizeTheatreElements,
8272
8276
  D as debugDispatcher,
8273
8277
  bo as defaultTheatreCallback,
8274
8278
  Co as detectSettings,
@@ -8285,6 +8289,6 @@ export {
8285
8289
  Ua as randomID,
8286
8290
  fs as resetThreeObjects,
8287
8291
  Ae as round,
8288
- Mo as theatreEditorApp,
8292
+ Ao as theatreEditorApp,
8289
8293
  Li as totalThreeObjects
8290
8294
  };
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.121",
10
+ "version": "0.0.123",
11
11
  "homepage": "https://github.com/tomorrowevening/hermes#readme",
12
12
  "bugs": {
13
13
  "url": "https://github.com/tomorrowevening/hermes/issues"
@@ -22,8 +22,7 @@
22
22
  "dist/hermes.es.js",
23
23
  "dist/hermes.cjs.js",
24
24
  "dist/style.css",
25
- "types/**/*.d.ts",
26
- "src/webworkers/LoadWorker.ts"
25
+ "types/**/*.d.ts"
27
26
  ],
28
27
  "exports": {
29
28
  ".": {
@@ -31,7 +30,7 @@
31
30
  "require": "./dist/hermes.cjs.js",
32
31
  "types": "./types/index.d.ts"
33
32
  },
34
- "./dist/style.css": "./dist/style.css"
33
+ "./style.css": "./dist/style.css"
35
34
  },
36
35
  "repository": {
37
36
  "type": "git",
package/types/index.d.ts CHANGED
@@ -5,6 +5,7 @@ export * from './utils/math';
5
5
  export * from './utils/three';
6
6
  export * from './webworkers/types';
7
7
  export * from './webworkers/ProxyManager';
8
+ export { default as CreateLoadWorker } from './webworkers/CreateLoadWorker';
8
9
  export { default as Application } from './core/Application';
9
10
  export { debugDispatcher, ToolEvents } from './editor/global';
10
11
  export { default as BaseRemote } from './core/remote/BaseRemote';
@@ -0,0 +1 @@
1
+ export default function CreateLoadWorker(): Worker;
@@ -1,161 +0,0 @@
1
- import { Group, Object3DEventMap } from 'three';
2
- import { FBXLoader } from 'three/examples/jsm/Addons.js';
3
- import { DRACOLoader } from 'three/examples/jsm/loaders/DRACOLoader.js';
4
- import { GLTF, GLTFLoader } from 'three/examples/jsm/loaders/GLTFLoader.js';
5
- import { Assets, File, ModelLite } from './types';
6
-
7
- let loadedAssets = 0;
8
- let assetList: File[] = [];
9
-
10
- const assets: Assets = {
11
- audio: {},
12
- blob: {},
13
- buffer: {},
14
- images: {},
15
- json: {},
16
- models: {},
17
- video: {},
18
- };
19
-
20
- // Loaders
21
-
22
- const draco = new DRACOLoader();
23
- draco.setDecoderPath('/libs/draco/');
24
- draco.preload();
25
-
26
- const fbxLoader = new FBXLoader();
27
-
28
- const gltfLoader = new GLTFLoader();
29
- gltfLoader.setDRACOLoader(draco);
30
-
31
- // Load functions
32
-
33
- async function loadArrayBuffer(url: string): Promise<ArrayBuffer> {
34
- const response = await fetch(url);
35
- return await response.arrayBuffer();
36
- }
37
-
38
- async function loadBlob(url: string): Promise<Blob> {
39
- const response = await fetch(url);
40
- return await response.blob();
41
- }
42
-
43
- async function loadFBX(url: string): Promise<ModelLite> {
44
- return new Promise((resolve) => {
45
- fbxLoader.loadAsync(url)
46
- .then((value: Group<Object3DEventMap>) => {
47
- resolve({
48
- animations: value.animations.map(animation => animation.toJSON(animation)),
49
- scene: value.toJSON(),
50
- });
51
- })
52
- .catch((reason: any) => {
53
- console.log('FBX Error:');
54
- console.log(reason);
55
- });
56
- });
57
- }
58
-
59
- async function loadGLTF(url: string): Promise<ModelLite> {
60
- return new Promise((resolve) => {
61
- gltfLoader.loadAsync(url)
62
- .then((value: GLTF) => {
63
- resolve({
64
- animations: value.animations.map(animation => animation.toJSON(animation)),
65
- cameras: value.cameras.map(camera => camera.toJSON()),
66
- scene: value.scene.toJSON(),
67
- });
68
- })
69
- .catch((reason: any) => {
70
- console.log('GLTF Error:');
71
- console.log(reason);
72
- });
73
- });
74
- }
75
-
76
- async function loadImage(url: string): Promise<ImageBitmap> {
77
- const blob = await loadBlob(url);
78
- return await createImageBitmap(blob);
79
- }
80
-
81
- async function loadJSON(url: string): Promise<any> {
82
- const response = await fetch(url);
83
- return response.json();
84
- }
85
-
86
- // Load calls
87
-
88
- function loadStart() {
89
- assetList.forEach((item: File) => {
90
- switch (item.type) {
91
- case 'audio':
92
- loadArrayBuffer(item.file).then((value: ArrayBuffer) => {
93
- assets.audio[item.name] = value;
94
- onLoad();
95
- });
96
- break;
97
- case 'blob':
98
- loadBlob(item.file).then((value: Blob) => {
99
- assets.blob[item.name] = value;
100
- onLoad();
101
- });
102
- break;
103
- case 'buffer':
104
- loadArrayBuffer(item.file).then((value: ArrayBuffer) => {
105
- assets.buffer[item.name] = value;
106
- onLoad();
107
- });
108
- break;
109
- case 'fbx':
110
- loadFBX(item.file).then((value: ModelLite) => {
111
- assets.models[item.name] = value;
112
- onLoad();
113
- });
114
- break;
115
- case 'gltf':
116
- loadGLTF(item.file).then((value: ModelLite) => {
117
- assets.models[item.name] = value;
118
- onLoad();
119
- });
120
- break;
121
- case 'image':
122
- loadImage(item.file).then((value: ImageBitmap) => {
123
- assets.images[item.name] = value;
124
- onLoad();
125
- });
126
- break;
127
- case 'json':
128
- loadJSON(item.file).then((value: any) => {
129
- assets.json[item.name] = value;
130
- onLoad();
131
- });
132
- break;
133
- case 'video':
134
- loadBlob(item.file).then((value: Blob) => {
135
- assets.video[item.name] = value;
136
- onLoad();
137
- });
138
- break;
139
- }
140
- });
141
- }
142
-
143
- function onLoad() {
144
- loadedAssets++;
145
- if (loadedAssets >= assetList.length) loadComplete();
146
- }
147
-
148
- function loadComplete() {
149
- self.postMessage({ type: 'loadComplete', data: assets });
150
- }
151
-
152
- // Worker
153
-
154
- self.onmessage = (event: MessageEvent) => {
155
- switch (event.data.type) {
156
- case 'loadStart':
157
- assetList = event.data.data;
158
- loadStart();
159
- break;
160
- }
161
- };