@sanox/sangine-core 0.4.3 → 0.4.5
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/assetFetcher.d.ts +3 -0
- package/dist/assetFetcher.d.ts.map +1 -0
- package/dist/index.cjs.js +1 -1
- package/dist/index.es.js +115 -109
- package/dist/rendererService.d.ts.map +1 -1
- package/dist/wasm/sangine/sangine.d.ts +1 -1
- package/dist/wasm/sangine/{sangine.10c8ee57.js → sangine.ecedf539.js} +12 -12
- package/dist/wasm/sangine/{sangine_bg.10c8ee57.wasm → sangine_bg.ecedf539.wasm} +0 -0
- package/dist/wasm/sangine/sangine_bg.wasm.d.ts +1 -1
- package/dist/wasm-hashes/sangine.d.ts +1 -1
- package/dist/worker/decodeWorkerImpl.d.ts.map +1 -1
- package/dist/worker/pool.d.ts +1 -1
- package/dist/worker/pool.d.ts.map +1 -1
- package/dist/worker/workerTask.d.ts +12 -0
- package/dist/worker/workerTask.d.ts.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"assetFetcher.d.ts","sourceRoot":"","sources":["../src/assetFetcher.ts"],"names":[],"mappings":"AAGA,MAAM,MAAM,SAAS,GAAG,SAAS,GAAG,MAAM,CAAA;AAE1C,wBAAsB,aAAa,CACjC,IAAI,EAAE,SAAS,EACf,EAAE,EAAE,MAAM,EACV,GAAG,EAAE,MAAM,GACV,OAAO,CAAC,WAAW,CAAC,CAiBtB"}
|
package/dist/index.cjs.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var g=Object.defineProperty;var f=(n,e,t)=>e in n?g(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t;var d=(n,e,t)=>f(n,typeof e!="symbol"?e+"":e,t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const y="sangine-assets-v2";let l=null;async function u(n,e,t){if(typeof caches>"u"){const a=await fetch(t);if(!a.ok)throw new Error(`fetch ${t} failed: ${a.status}`);return a.arrayBuffer()}l??(l=caches.open(y));const s=await l,o=`https://sangine-asset-cache/${n}/${e}`,r=await s.match(o);if(r)return r.arrayBuffer();const i=await fetch(t);if(!i.ok)throw new Error(`fetch ${t} failed: ${i.status}`);return s.put(o,i.clone()).catch(()=>{}),i.arrayBuffer()}const m="/static/sangine/wasm",_="ecedf539";class b{constructor(e,t){d(this,"workers");d(this,"idle");d(this,"queue",[]);this.workers=Array.from({length:t},e),this.idle=[...this.workers]}run(e,t){return new Promise((s,o)=>{const r=this.idle.pop();r?this.dispatch(r,e,t,s,o):this.queue.push({request:e,transfer:t,resolve:s,reject:o})})}dispatch(e,t,s,o,r){const i=h=>{o(h.data),c(),this.release(e)},a=h=>{r(h),c(),this.release(e)},c=()=>{e.removeEventListener("message",i),e.removeEventListener("error",a)};e.addEventListener("message",i,{once:!0}),e.addEventListener("error",a,{once:!0}),e.postMessage(t,s??[])}release(e){const t=this.queue.shift();t?this.dispatch(e,t.request,t.transfer,t.resolve,t.reject):this.idle.push(e)}broadcast(e){for(const t of this.workers)t.postMessage(e)}terminate(){for(const e of this.workers)e.terminate()}}class R{constructor(e){d(this,"wasm",null);d(this,"callbackRegistry",{});d(this,"userActionRegistry",{});d(this,"assetsDownloadingRegistry",{});d(this,"windowCreatedPromiseRegistry",{});d(this,"windowCreatedPromiseResolveRegistry",{});d(this,"_inited",!1);d(this,"decodePool");d(this,"_readyPromise");d(this,"_resolveReady");d(this,"_rejectReady");this.config=e,this._readyPromise=new Promise((t,s)=>{this._resolveReady=t,this._rejectReady=s}),this.config=e}async init(){if(!(typeof window>"u")){if(this._inited)return this._readyPromise;try{const t=await import(new URL(`${m}/sangine/sangine.${_}.js`,window.location.origin).toString());await t.default(),this.wasm=t,this._inited=!0;const s=Math.min(this.config.numWorkers??(navigator.hardwareConcurrency||2)-1,2);this.decodePool=new b(()=>this.config.createDecodeWorker(),Math.max(s,1)),this.wasm.register_asset_decoder(this.decodeAsset.bind(this)),this.wasm.register_event_listener(this.handleSangineEvent.bind(this)),this._resolveReady()}catch(e){throw this._rejectReady(e),e}return this._readyPromise}}ready(){return this._readyPromise}get inited(){return this._inited}getWasm(){if(!this.wasm)throw new Error("RendererService not initialized");return this.wasm}handleActionChanged(e,t){this.userActionRegistry[e]=t;for(const s of this.callbackRegistry[e].actionChanged)s(t)}handleMeasurementCreated(e,t){for(const s of this.callbackRegistry[e].measurementCreated)s(t)}handleRouteUpdated(e,t){for(const s of this.callbackRegistry[e].routeUpdated)s(t)}handleAssetsDownloading(e,t){this.assetsDownloadingRegistry[e]=t;for(const s of this.callbackRegistry[e].assetsDownloading)s(t)}handleUserInteractionStarted(e){for(const t of this.callbackRegistry[e].userInteractionStarted)t()}handleSangineEvent(e,t){t==="ready"?this.windowCreatedPromiseResolveRegistry[e]():t==="userInteractionStarted"?this.handleUserInteractionStarted(e):"actionChanged"in t?this.handleActionChanged(e,t.actionChanged.action):"measurementCreated"in t?this.handleMeasurementCreated(e,t.measurementCreated.measurement):"routeUnderConstructionUpdated"in t?this.handleRouteUpdated(e,t.routeUnderConstructionUpdated.route):"assetsDownloading"in t&&this.handleAssetsDownloading(e,t.assetsDownloading.downloading)}createWindow(e,t,s){if(!this.wasm)throw new Error("WASM not initialized");let o;const r=new Promise(a=>{o=a}),i=this.wasm.create_window(e,t,s);return this.windowCreatedPromiseResolveRegistry[i]=o,this.callbackRegistry[i]={actionChanged:[],routeUpdated:[],measurementCreated:[],assetsDownloading:[],userInteractionStarted:[]},this.userActionRegistry[i]="watching",this.windowCreatedPromiseRegistry[i]=r,i}getAssetsDownloading(e){return this.assetsDownloadingRegistry[e]||!1}readUserAction(e){return this.userActionRegistry[e]}windowReady(e){return this.windowCreatedPromiseRegistry[e]}registerCallback(e,t,s){this.callbackRegistry[e][t].push(s)}setWindowAction(e,t){if(!this.wasm)throw new Error("WASM not initialized");this.wasm.set_window_action(e,t)}destroyWindow(e){if(!this.wasm)throw new Error("WASM not initialized");this.wasm.destroy_window(e),delete this.callbackRegistry[e],delete this.userActionRegistry[e]}setRouteHighlight(e,t,s){if(!this.wasm)throw new Error("WASM not initialized");this.wasm.set_route_highlight(e,t,s)}setRouteVisible(e,t,s){if(!this.wasm)throw new Error("WASM not initialized");this.wasm.set_route_visible(e,t,s)}animateToRoute(e,t){if(!this.wasm)throw new Error("WASM not initialized");this.wasm.animate_to_route(e,t)}setSunProperties(e,t){if(!this.wasm)throw new Error("WASM not initialized");this.wasm.set_sun_properties(e,t)}setAmbientLighting(e,t){if(!this.wasm)throw new Error("WASM not initialized");this.wasm.set_ambient_lighting(e,t)}setLightingMode(e,t){if(!this.wasm)throw new Error("WASM not initialized");this.wasm.set_lighting_mode(e,t)}setNorthCorrection(e,t){if(!this.wasm)throw new Error("WASM not initialized");this.wasm.set_north_correction(e,t)}setGpuMemoryBudgetMb(e,t){if(!this.wasm)throw new Error("WASM not initialized");this.wasm.set_gpu_memory_budget_mb(e,t)}setRenderQuality(e,t){if(!this.wasm)throw new Error("WASM not initialized");this.wasm.set_render_quality(e,t)}readCameraPos(e){if(!this.wasm)throw new Error("WASM not initialized");return this.wasm.read_camera_pos(e)}animateTo(e,t){if(!this.wasm)throw new Error("WASM not initialized");this.wasm.animate_to(e,t)}setScale(e,t){if(!this.wasm)throw new Error("WASM not initialized");this.wasm.set_window_scale(e,t)}async decodeAsset(e){if(!this.decodePool)throw new Error("Renderer not initialized");if("texture-file"in e){const{pk:r,url:i,encoding:a,format:c}=e["texture-file"],h=await u("texture",r,i);return a==="ktx2"?this.decodePool.run({kind:"texture-basis",bytes:h,format:c},[h]):this.decodePool.run({kind:"texture-image",bytes:h},[h])}const{pk:t,url:s}=e["model-part-mesh"],o=await u("mesh",t,s);return this.decodePool.run({kind:"model-sbo",bytes:o},[o])}destroy(){var e;(e=this.decodePool)==null||e.terminate()}}const p="bf116aa6",A=0;function M(n){let e=!1,t=null;async function s(){if(e)return;const r=await import(new URL(`${m}/decode/wasm_decode.${p}.js`,n.location.origin).href);await r.default(),await r.init_basis(),t=r,e=!0}n.onmessage=async o=>{const r=o.data;try{if(r.kind==="texture-basis"){await s();const i=new Uint8Array(r.bytes),a=t.transcode_basis(i,r.format);n.postMessage({success:!0,width:a.width,height:a.height,data:a.data.buffer,format:a.format},[a.data.buffer])}else if(r.kind==="texture-image"){const i=new Blob([r.bytes]),a=await createImageBitmap(i),c=new OffscreenCanvas(a.width,a.height),h=c.getContext("2d");if(h===null)throw new Error("Couldnt create canvas");h.drawImage(a,0,0);const w=h.getImageData(0,0,c.width,c.height);n.postMessage({success:!0,width:c.width,height:c.height,data:w.data.buffer,format:A},[w.data.buffer])}else if(r.kind==="model-sbo"){await s();const i=new Uint8Array(r.bytes),a=t.decode_sbo(i);n.postMessage({success:!0,data:a.buffer},[a.buffer])}else{const i=r;throw new Error(`unknown task kind: ${i.kind}`)}}catch(i){n.postMessage({success:!1,error:i.message})}}}exports.RendererService=R;exports.registerDecodeWorker=M;
|
package/dist/index.es.js
CHANGED
|
@@ -1,33 +1,49 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
const
|
|
5
|
-
|
|
1
|
+
var g = Object.defineProperty;
|
|
2
|
+
var f = (n, e, t) => e in n ? g(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t;
|
|
3
|
+
var d = (n, e, t) => f(n, typeof e != "symbol" ? e + "" : e, t);
|
|
4
|
+
const y = "sangine-assets-v2";
|
|
5
|
+
let l = null;
|
|
6
|
+
async function m(n, e, t) {
|
|
7
|
+
if (typeof caches > "u") {
|
|
8
|
+
const a = await fetch(t);
|
|
9
|
+
if (!a.ok) throw new Error(`fetch ${t} failed: ${a.status}`);
|
|
10
|
+
return a.arrayBuffer();
|
|
11
|
+
}
|
|
12
|
+
l ?? (l = caches.open(y));
|
|
13
|
+
const s = await l, o = `https://sangine-asset-cache/${n}/${e}`, r = await s.match(o);
|
|
14
|
+
if (r) return r.arrayBuffer();
|
|
15
|
+
const i = await fetch(t);
|
|
16
|
+
if (!i.ok) throw new Error(`fetch ${t} failed: ${i.status}`);
|
|
17
|
+
return s.put(o, i.clone()).catch(() => {
|
|
18
|
+
}), i.arrayBuffer();
|
|
19
|
+
}
|
|
20
|
+
const u = "/static/sangine/wasm", _ = "ecedf539";
|
|
21
|
+
class b {
|
|
6
22
|
constructor(e, t) {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
23
|
+
d(this, "workers");
|
|
24
|
+
d(this, "idle");
|
|
25
|
+
d(this, "queue", []);
|
|
10
26
|
this.workers = Array.from({ length: t }, e), this.idle = [...this.workers];
|
|
11
27
|
}
|
|
12
|
-
run(e) {
|
|
13
|
-
return new Promise((
|
|
14
|
-
const
|
|
15
|
-
|
|
28
|
+
run(e, t) {
|
|
29
|
+
return new Promise((s, o) => {
|
|
30
|
+
const r = this.idle.pop();
|
|
31
|
+
r ? this.dispatch(r, e, t, s, o) : this.queue.push({ request: e, transfer: t, resolve: s, reject: o });
|
|
16
32
|
});
|
|
17
33
|
}
|
|
18
|
-
dispatch(e, t, s,
|
|
19
|
-
const
|
|
20
|
-
|
|
21
|
-
},
|
|
22
|
-
h
|
|
23
|
-
},
|
|
24
|
-
e.removeEventListener("message",
|
|
34
|
+
dispatch(e, t, s, o, r) {
|
|
35
|
+
const i = (h) => {
|
|
36
|
+
o(h.data), c(), this.release(e);
|
|
37
|
+
}, a = (h) => {
|
|
38
|
+
r(h), c(), this.release(e);
|
|
39
|
+
}, c = () => {
|
|
40
|
+
e.removeEventListener("message", i), e.removeEventListener("error", a);
|
|
25
41
|
};
|
|
26
|
-
e.addEventListener("message",
|
|
42
|
+
e.addEventListener("message", i, { once: !0 }), e.addEventListener("error", a, { once: !0 }), e.postMessage(t, s ?? []);
|
|
27
43
|
}
|
|
28
44
|
release(e) {
|
|
29
45
|
const t = this.queue.shift();
|
|
30
|
-
t ? this.dispatch(e, t.request, t.resolve, t.reject) : this.idle.push(e);
|
|
46
|
+
t ? this.dispatch(e, t.request, t.transfer, t.resolve, t.reject) : this.idle.push(e);
|
|
31
47
|
}
|
|
32
48
|
broadcast(e) {
|
|
33
49
|
for (const t of this.workers)
|
|
@@ -38,19 +54,19 @@ class E {
|
|
|
38
54
|
e.terminate();
|
|
39
55
|
}
|
|
40
56
|
}
|
|
41
|
-
class
|
|
57
|
+
class M {
|
|
42
58
|
constructor(e) {
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
59
|
+
d(this, "wasm", null);
|
|
60
|
+
d(this, "callbackRegistry", {});
|
|
61
|
+
d(this, "userActionRegistry", {});
|
|
62
|
+
d(this, "assetsDownloadingRegistry", {});
|
|
63
|
+
d(this, "windowCreatedPromiseRegistry", {});
|
|
64
|
+
d(this, "windowCreatedPromiseResolveRegistry", {});
|
|
65
|
+
d(this, "_inited", !1);
|
|
66
|
+
d(this, "decodePool");
|
|
67
|
+
d(this, "_readyPromise");
|
|
68
|
+
d(this, "_resolveReady");
|
|
69
|
+
d(this, "_rejectReady");
|
|
54
70
|
this.config = e, this._readyPromise = new Promise((t, s) => {
|
|
55
71
|
this._resolveReady = t, this._rejectReady = s;
|
|
56
72
|
}), this.config = e;
|
|
@@ -60,15 +76,15 @@ class P {
|
|
|
60
76
|
if (this._inited) return this._readyPromise;
|
|
61
77
|
try {
|
|
62
78
|
const t = await import(new URL(
|
|
63
|
-
`${
|
|
79
|
+
`${u}/sangine/sangine.${_}.js`,
|
|
64
80
|
window.location.origin
|
|
65
81
|
).toString());
|
|
66
82
|
await t.default(), this.wasm = t, this._inited = !0;
|
|
67
83
|
const s = Math.min(
|
|
68
84
|
this.config.numWorkers ?? (navigator.hardwareConcurrency || 2) - 1,
|
|
69
|
-
|
|
85
|
+
2
|
|
70
86
|
);
|
|
71
|
-
this.decodePool = new
|
|
87
|
+
this.decodePool = new b(
|
|
72
88
|
() => this.config.createDecodeWorker(),
|
|
73
89
|
Math.max(s, 1)
|
|
74
90
|
), this.wasm.register_asset_decoder(this.decodeAsset.bind(this)), this.wasm.register_event_listener(this.handleSangineEvent.bind(this)), this._resolveReady();
|
|
@@ -116,17 +132,17 @@ class P {
|
|
|
116
132
|
}
|
|
117
133
|
createWindow(e, t, s) {
|
|
118
134
|
if (!this.wasm) throw new Error("WASM not initialized");
|
|
119
|
-
let
|
|
120
|
-
const
|
|
121
|
-
|
|
122
|
-
}),
|
|
123
|
-
return this.windowCreatedPromiseResolveRegistry[
|
|
135
|
+
let o;
|
|
136
|
+
const r = new Promise((a) => {
|
|
137
|
+
o = a;
|
|
138
|
+
}), i = this.wasm.create_window(e, t, s);
|
|
139
|
+
return this.windowCreatedPromiseResolveRegistry[i] = o, this.callbackRegistry[i] = {
|
|
124
140
|
actionChanged: [],
|
|
125
141
|
routeUpdated: [],
|
|
126
142
|
measurementCreated: [],
|
|
127
143
|
assetsDownloading: [],
|
|
128
144
|
userInteractionStarted: []
|
|
129
|
-
}, this.userActionRegistry[
|
|
145
|
+
}, this.userActionRegistry[i] = "watching", this.windowCreatedPromiseRegistry[i] = r, i;
|
|
130
146
|
}
|
|
131
147
|
getAssetsDownloading(e) {
|
|
132
148
|
return this.assetsDownloadingRegistry[e] || !1;
|
|
@@ -198,84 +214,74 @@ class P {
|
|
|
198
214
|
}
|
|
199
215
|
async decodeAsset(e) {
|
|
200
216
|
if (!this.decodePool) throw new Error("Renderer not initialized");
|
|
201
|
-
|
|
217
|
+
if ("texture-file" in e) {
|
|
218
|
+
const { pk: r, url: i, encoding: a, format: c } = e["texture-file"], h = await m("texture", r, i);
|
|
219
|
+
return a === "ktx2" ? this.decodePool.run({ kind: "texture-basis", bytes: h, format: c }, [h]) : this.decodePool.run({ kind: "texture-image", bytes: h }, [h]);
|
|
220
|
+
}
|
|
221
|
+
const { pk: t, url: s } = e["model-part-mesh"], o = await m("mesh", t, s);
|
|
222
|
+
return this.decodePool.run({ kind: "model-sbo", bytes: o }, [o]);
|
|
202
223
|
}
|
|
203
224
|
destroy() {
|
|
204
225
|
var e;
|
|
205
226
|
(e = this.decodePool) == null || e.terminate();
|
|
206
227
|
}
|
|
207
228
|
}
|
|
208
|
-
const
|
|
209
|
-
function
|
|
210
|
-
let e = !1, t = null
|
|
211
|
-
async function
|
|
212
|
-
if (s) {
|
|
213
|
-
const n = `https://sangine-asset-cache/${o}`, m = await s.match(n);
|
|
214
|
-
if (m) return m;
|
|
215
|
-
const w = await fetch(i);
|
|
216
|
-
return w.ok && await s.put(n, w.clone()), w;
|
|
217
|
-
}
|
|
218
|
-
return fetch(i);
|
|
219
|
-
}
|
|
220
|
-
async function l() {
|
|
229
|
+
const R = "bf116aa6", p = 0;
|
|
230
|
+
function E(n) {
|
|
231
|
+
let e = !1, t = null;
|
|
232
|
+
async function s() {
|
|
221
233
|
if (e) return;
|
|
222
|
-
const
|
|
223
|
-
`${
|
|
224
|
-
|
|
234
|
+
const r = await import(new URL(
|
|
235
|
+
`${u}/decode/wasm_decode.${R}.js`,
|
|
236
|
+
n.location.origin
|
|
225
237
|
).href);
|
|
226
|
-
await
|
|
227
|
-
}
|
|
228
|
-
|
|
229
|
-
const
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
}
|
|
266
|
-
} catch (n) {
|
|
267
|
-
a.postMessage({ success: !1, error: n.message });
|
|
238
|
+
await r.default(), await r.init_basis(), t = r, e = !0;
|
|
239
|
+
}
|
|
240
|
+
n.onmessage = async (o) => {
|
|
241
|
+
const r = o.data;
|
|
242
|
+
try {
|
|
243
|
+
if (r.kind === "texture-basis") {
|
|
244
|
+
await s();
|
|
245
|
+
const i = new Uint8Array(r.bytes), a = t.transcode_basis(i, r.format);
|
|
246
|
+
n.postMessage(
|
|
247
|
+
{
|
|
248
|
+
success: !0,
|
|
249
|
+
width: a.width,
|
|
250
|
+
height: a.height,
|
|
251
|
+
data: a.data.buffer,
|
|
252
|
+
format: a.format
|
|
253
|
+
},
|
|
254
|
+
[a.data.buffer]
|
|
255
|
+
);
|
|
256
|
+
} else if (r.kind === "texture-image") {
|
|
257
|
+
const i = new Blob([r.bytes]), a = await createImageBitmap(i), c = new OffscreenCanvas(a.width, a.height), h = c.getContext("2d");
|
|
258
|
+
if (h === null) throw new Error("Couldnt create canvas");
|
|
259
|
+
h.drawImage(a, 0, 0);
|
|
260
|
+
const w = h.getImageData(0, 0, c.width, c.height);
|
|
261
|
+
n.postMessage(
|
|
262
|
+
{
|
|
263
|
+
success: !0,
|
|
264
|
+
width: c.width,
|
|
265
|
+
height: c.height,
|
|
266
|
+
data: w.data.buffer,
|
|
267
|
+
format: p
|
|
268
|
+
},
|
|
269
|
+
[w.data.buffer]
|
|
270
|
+
);
|
|
271
|
+
} else if (r.kind === "model-sbo") {
|
|
272
|
+
await s();
|
|
273
|
+
const i = new Uint8Array(r.bytes), a = t.decode_sbo(i);
|
|
274
|
+
n.postMessage({ success: !0, data: a.buffer }, [a.buffer]);
|
|
275
|
+
} else {
|
|
276
|
+
const i = r;
|
|
277
|
+
throw new Error(`unknown task kind: ${i.kind}`);
|
|
268
278
|
}
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
const { pk: n, url: m } = i["model-part-mesh"], w = await h(n, m);
|
|
272
|
-
if (!w.ok) throw new Error(`HTTP error! status: ${w.status}`);
|
|
273
|
-
const g = await w.arrayBuffer(), _ = new Uint8Array(g), c = t.decode_sbo(_);
|
|
274
|
-
a.postMessage({ success: !0, data: c.buffer }, [c.buffer]);
|
|
279
|
+
} catch (i) {
|
|
280
|
+
n.postMessage({ success: !1, error: i.message });
|
|
275
281
|
}
|
|
276
282
|
};
|
|
277
283
|
}
|
|
278
284
|
export {
|
|
279
|
-
|
|
280
|
-
|
|
285
|
+
M as RendererService,
|
|
286
|
+
E as registerDecodeWorker
|
|
281
287
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rendererService.d.ts","sourceRoot":"","sources":["../src/rendererService.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"rendererService.d.ts","sourceRoot":"","sources":["../src/rendererService.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,SAAS,EACT,UAAU,EACV,uBAAuB,EACvB,YAAY,EACZ,WAAW,EACX,oBAAoB,EACpB,cAAc,EACd,iBAAiB,EACjB,KAAK,EACL,YAAY,EACZ,KAAK,EACL,aAAa,EACb,UAAU,EACX,MAAM,YAAY,CAAA;AAEnB,OAAO,KAAK,KAAK,aAAa,MAAM,sBAAsB,CAAA;AAK1D,KAAK,qBAAqB,GAAG,CAAC,MAAM,EAAE,UAAU,KAAK,IAAI,CAAA;AACzD,KAAK,oBAAoB,GAAG,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAA;AAClD,KAAK,0BAA0B,GAAG,CAAC,WAAW,EAAE,WAAW,KAAK,IAAI,CAAA;AACpE,KAAK,yBAAyB,GAAG,CAAC,WAAW,EAAE,OAAO,KAAK,IAAI,CAAA;AAC/D,KAAK,YAAY,GAAG,MAAM,IAAI,CAAA;AAE9B,UAAU,WAAW;IACnB,aAAa,EAAE,qBAAqB,CAAA;IACpC,YAAY,EAAE,oBAAoB,CAAA;IAClC,kBAAkB,EAAE,0BAA0B,CAAA;IAC9C,iBAAiB,EAAE,yBAAyB,CAAA;IAC5C,sBAAsB,E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only memory: WebAssembly.Memory;
|
|
47
|
-
readonly run: () => void;
|
|
48
47
|
readonly animate_to: (a: number, b: any) => [number, number];
|
|
49
48
|
readonly animate_to_route: (a: number, b: number, c: number) => [number, number];
|
|
50
49
|
readonly create_window: (a: number, b: number, c: any, d: number) => [number, number, number];
|
|
@@ -62,6 +61,7 @@ export interface InitOutput {
|
|
|
62
61
|
readonly set_sun_properties: (a: number, b: any) => [number, number];
|
|
63
62
|
readonly set_window_action: (a: number, b: any) => [number, number];
|
|
64
63
|
readonly set_window_scale: (a: number, b: number) => [number, number];
|
|
64
|
+
readonly run: () => void;
|
|
65
65
|
readonly wasm_bindgen__convert__closures_____invoke__hd8590da73942d3e0: (a: number, b: number, c: any) => [number, number];
|
|
66
66
|
readonly wasm_bindgen__convert__closures_____invoke__h6ff3e7511bd758a3: (a: number, b: number, c: any, d: any) => void;
|
|
67
67
|
readonly wasm_bindgen__convert__closures_____invoke__h00cde4323839146b: (a: number, b: number, c: any) => void;
|
|
@@ -2705,57 +2705,57 @@ function __wbg_get_imports() {
|
|
|
2705
2705
|
arg0.writeTexture(arg1, arg2, arg3, arg4);
|
|
2706
2706
|
}, arguments); },
|
|
2707
2707
|
__wbindgen_cast_0000000000000001: function(arg0, arg1) {
|
|
2708
|
-
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx:
|
|
2708
|
+
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 3826, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
2709
2709
|
const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__h00cde4323839146b);
|
|
2710
2710
|
return ret;
|
|
2711
2711
|
},
|
|
2712
2712
|
__wbindgen_cast_0000000000000002: function(arg0, arg1) {
|
|
2713
|
-
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx:
|
|
2713
|
+
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 3910, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
|
|
2714
2714
|
const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__hd8590da73942d3e0);
|
|
2715
2715
|
return ret;
|
|
2716
2716
|
},
|
|
2717
2717
|
__wbindgen_cast_0000000000000003: function(arg0, arg1) {
|
|
2718
|
-
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("Array<any>"), NamedExternref("ResizeObserver")], shim_idx:
|
|
2718
|
+
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("Array<any>"), NamedExternref("ResizeObserver")], shim_idx: 3833, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
2719
2719
|
const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__h6ff3e7511bd758a3);
|
|
2720
2720
|
return ret;
|
|
2721
2721
|
},
|
|
2722
2722
|
__wbindgen_cast_0000000000000004: function(arg0, arg1) {
|
|
2723
|
-
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("Array<any>")], shim_idx:
|
|
2723
|
+
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("Array<any>")], shim_idx: 3826, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
2724
2724
|
const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__h00cde4323839146b_3);
|
|
2725
2725
|
return ret;
|
|
2726
2726
|
},
|
|
2727
2727
|
__wbindgen_cast_0000000000000005: function(arg0, arg1) {
|
|
2728
|
-
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("Event")], shim_idx:
|
|
2728
|
+
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("Event")], shim_idx: 3826, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
2729
2729
|
const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__h00cde4323839146b_4);
|
|
2730
2730
|
return ret;
|
|
2731
2731
|
},
|
|
2732
2732
|
__wbindgen_cast_0000000000000006: function(arg0, arg1) {
|
|
2733
|
-
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("FocusEvent")], shim_idx:
|
|
2733
|
+
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("FocusEvent")], shim_idx: 3826, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
2734
2734
|
const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__h00cde4323839146b_5);
|
|
2735
2735
|
return ret;
|
|
2736
2736
|
},
|
|
2737
2737
|
__wbindgen_cast_0000000000000007: function(arg0, arg1) {
|
|
2738
|
-
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("KeyboardEvent")], shim_idx:
|
|
2738
|
+
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("KeyboardEvent")], shim_idx: 3826, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
2739
2739
|
const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__h00cde4323839146b_6);
|
|
2740
2740
|
return ret;
|
|
2741
2741
|
},
|
|
2742
2742
|
__wbindgen_cast_0000000000000008: function(arg0, arg1) {
|
|
2743
|
-
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("PageTransitionEvent")], shim_idx:
|
|
2743
|
+
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("PageTransitionEvent")], shim_idx: 3826, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
2744
2744
|
const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__h00cde4323839146b_7);
|
|
2745
2745
|
return ret;
|
|
2746
2746
|
},
|
|
2747
2747
|
__wbindgen_cast_0000000000000009: function(arg0, arg1) {
|
|
2748
|
-
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("PointerEvent")], shim_idx:
|
|
2748
|
+
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("PointerEvent")], shim_idx: 3826, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
2749
2749
|
const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__h00cde4323839146b_8);
|
|
2750
2750
|
return ret;
|
|
2751
2751
|
},
|
|
2752
2752
|
__wbindgen_cast_000000000000000a: function(arg0, arg1) {
|
|
2753
|
-
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("WheelEvent")], shim_idx:
|
|
2753
|
+
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("WheelEvent")], shim_idx: 3826, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
2754
2754
|
const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__h00cde4323839146b_9);
|
|
2755
2755
|
return ret;
|
|
2756
2756
|
},
|
|
2757
2757
|
__wbindgen_cast_000000000000000b: function(arg0, arg1) {
|
|
2758
|
-
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [], shim_idx:
|
|
2758
|
+
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [], shim_idx: 3831, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
2759
2759
|
const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__hdb7f99c0126c5c28);
|
|
2760
2760
|
return ret;
|
|
2761
2761
|
},
|
|
@@ -3324,7 +3324,7 @@ async function __wbg_init(module_or_path) {
|
|
|
3324
3324
|
}
|
|
3325
3325
|
|
|
3326
3326
|
if (module_or_path === undefined) {
|
|
3327
|
-
module_or_path = new URL('sangine_bg.
|
|
3327
|
+
module_or_path = new URL('sangine_bg.ecedf539.wasm', import.meta.url);
|
|
3328
3328
|
}
|
|
3329
3329
|
const imports = __wbg_get_imports();
|
|
3330
3330
|
|
|
Binary file
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
/* tslint:disable */
|
|
2
2
|
/* eslint-disable */
|
|
3
3
|
export const memory: WebAssembly.Memory;
|
|
4
|
-
export const run: () => void;
|
|
5
4
|
export const animate_to: (a: number, b: any) => [number, number];
|
|
6
5
|
export const animate_to_route: (a: number, b: number, c: number) => [number, number];
|
|
7
6
|
export const create_window: (a: number, b: number, c: any, d: number) => [number, number, number];
|
|
@@ -19,6 +18,7 @@ export const set_route_visible: (a: number, b: number, c: number, d: number) =>
|
|
|
19
18
|
export const set_sun_properties: (a: number, b: any) => [number, number];
|
|
20
19
|
export const set_window_action: (a: number, b: any) => [number, number];
|
|
21
20
|
export const set_window_scale: (a: number, b: number) => [number, number];
|
|
21
|
+
export const run: () => void;
|
|
22
22
|
export const wasm_bindgen__convert__closures_____invoke__hd8590da73942d3e0: (a: number, b: number, c: any) => [number, number];
|
|
23
23
|
export const wasm_bindgen__convert__closures_____invoke__h6ff3e7511bd758a3: (a: number, b: number, c: any, d: any) => void;
|
|
24
24
|
export const wasm_bindgen__convert__closures_____invoke__h00cde4323839146b: (a: number, b: number, c: any) => void;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const SANGINE_HASH = "
|
|
1
|
+
export declare const SANGINE_HASH = "ecedf539";
|
|
2
2
|
//# sourceMappingURL=sangine.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"decodeWorkerImpl.d.ts","sourceRoot":"","sources":["../../src/worker/decodeWorkerImpl.ts"],"names":[],"mappings":"AAeA,QAAA,MAAM,aAAa,IAAI,CAAA;AACvB,QAAA,MAAM,iBAAiB,IAAI,CAAA;AAC3B,QAAA,MAAM,eAAe,IAAI,CAAA;AACzB,QAAA,MAAM,UAAU,IAAI,CAAA;AACpB,QAAA,MAAM,UAAU,IAAI,CAAA;AACpB,QAAA,MAAM,aAAa,IAAI,CAAA;AACvB,QAAA,MAAM,gBAAgB,IAAI,CAAA;AAE1B,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,0BAA0B,
|
|
1
|
+
{"version":3,"file":"decodeWorkerImpl.d.ts","sourceRoot":"","sources":["../../src/worker/decodeWorkerImpl.ts"],"names":[],"mappings":"AAeA,QAAA,MAAM,aAAa,IAAI,CAAA;AACvB,QAAA,MAAM,iBAAiB,IAAI,CAAA;AAC3B,QAAA,MAAM,eAAe,IAAI,CAAA;AACzB,QAAA,MAAM,UAAU,IAAI,CAAA;AACpB,QAAA,MAAM,UAAU,IAAI,CAAA;AACpB,QAAA,MAAM,aAAa,IAAI,CAAA;AACvB,QAAA,MAAM,gBAAgB,IAAI,CAAA;AAE1B,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,0BAA0B,QAkEpE;AAED,OAAO,EACL,eAAe,EACf,aAAa,EACb,UAAU,EACV,gBAAgB,EAChB,iBAAiB,EACjB,UAAU,EACV,aAAa,GACd,CAAA"}
|
package/dist/worker/pool.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ export declare class WorkerPool<Request, Response> {
|
|
|
3
3
|
private idle;
|
|
4
4
|
private queue;
|
|
5
5
|
constructor(workerFactory: () => Worker, num: number);
|
|
6
|
-
run(request: Request): Promise<Response>;
|
|
6
|
+
run(request: Request, transfer?: Transferable[]): Promise<Response>;
|
|
7
7
|
private dispatch;
|
|
8
8
|
private release;
|
|
9
9
|
broadcast(message: unknown): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pool.d.ts","sourceRoot":"","sources":["../../src/worker/pool.ts"],"names":[],"mappings":"AAAA,qBAAa,UAAU,CAAC,OAAO,EAAE,QAAQ;IACvC,OAAO,CAAC,OAAO,CAAU;IACzB,OAAO,CAAC,IAAI,CAAU;IACtB,OAAO,CAAC,KAAK,
|
|
1
|
+
{"version":3,"file":"pool.d.ts","sourceRoot":"","sources":["../../src/worker/pool.ts"],"names":[],"mappings":"AAAA,qBAAa,UAAU,CAAC,OAAO,EAAE,QAAQ;IACvC,OAAO,CAAC,OAAO,CAAU;IACzB,OAAO,CAAC,IAAI,CAAU;IACtB,OAAO,CAAC,KAAK,CAKL;gBAEI,aAAa,EAAE,MAAM,MAAM,EAAE,GAAG,EAAE,MAAM;IAKpD,GAAG,CAAC,OAAO,EAAE,OAAO,EAAE,QAAQ,CAAC,EAAE,YAAY,EAAE,GAAG,OAAO,CAAC,QAAQ,CAAC;IAWnE,OAAO,CAAC,QAAQ;IA6BhB,OAAO,CAAC,OAAO;IASR,SAAS,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI;IAMjC,SAAS;CAKjB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workerTask.d.ts","sourceRoot":"","sources":["../../src/worker/workerTask.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,gBAAgB,GACxB;IAAE,IAAI,EAAE,eAAe,CAAC;IAAC,KAAK,EAAE,WAAW,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,GAC7D;IAAE,IAAI,EAAE,eAAe,CAAC;IAAC,KAAK,EAAE,WAAW,CAAA;CAAE,GAC7C;IAAE,IAAI,EAAE,WAAW,CAAC;IAAC,KAAK,EAAE,WAAW,CAAA;CAAE,CAAA"}
|