@nil-/xit 0.1.9 → 0.1.11
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/assets/bundler.js +13 -15
- package/assets/index.js +37 -48
- package/assets/svelte/index.js +711 -713
- package/assets/svelte/store.js +5 -5
- package/package.json +1 -1
package/assets/index.js
CHANGED
|
@@ -2,16 +2,8 @@ var P = (i) => {
|
|
|
2
2
|
throw TypeError(i);
|
|
3
3
|
};
|
|
4
4
|
var C = (i, e, n) => e.has(i) || P("Cannot " + n);
|
|
5
|
-
var w = (i, e, n) => (C(i, e, "read from private field"), n ? n.call(i) : e.get(i)), F = (i, e, n) => e.has(i) ? P("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(i) : e.set(i, n),
|
|
6
|
-
import "./svelte/internal/disclose-version.js";
|
|
7
|
-
import { b1 as append, bp as template, aZ as mount, a$ as unmount } from "./svelte/index.js";
|
|
8
|
-
import { action } from "./svelte/internal/client.js";
|
|
5
|
+
var w = (i, e, n) => (C(i, e, "read from private field"), n ? n.call(i) : e.get(i)), F = (i, e, n) => e.has(i) ? P("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(i) : e.set(i, n), S = (i, e, n, a) => (C(i, e, "write to private field"), a ? a.call(i, n) : e.set(i, n), n), W = (i, e, n) => (C(i, e, "access private method"), n);
|
|
9
6
|
import { w as writable, g as get } from "./svelte/store.js";
|
|
10
|
-
var root$1 = template('<div style="display: contents"></div>');
|
|
11
|
-
function ActionLoader(i, e) {
|
|
12
|
-
var n = root$1();
|
|
13
|
-
action(n, (a) => e.action(a)), append(i, n);
|
|
14
|
-
}
|
|
15
7
|
var j, I, E, M, D, L, N, $, U;
|
|
16
8
|
let Service$1 = (U = class {
|
|
17
9
|
constructor({ host: e, port: n }) {
|
|
@@ -23,35 +15,35 @@ let Service$1 = (U = class {
|
|
|
23
15
|
F(this, L);
|
|
24
16
|
F(this, N);
|
|
25
17
|
F(this, $);
|
|
26
|
-
|
|
18
|
+
S(this, N, `${e ?? "localhost"}${n != null ? `:${n}` : ""}`), S(this, E, 0), S(this, M, null), S(this, D, null), S(this, L, null), S(this, $, null);
|
|
27
19
|
}
|
|
28
20
|
on_message(e) {
|
|
29
|
-
|
|
21
|
+
S(this, L, e);
|
|
30
22
|
}
|
|
31
23
|
on_connect(e) {
|
|
32
|
-
|
|
24
|
+
S(this, M, e);
|
|
33
25
|
}
|
|
34
26
|
on_disconnect(e) {
|
|
35
|
-
|
|
27
|
+
S(this, D, e);
|
|
36
28
|
}
|
|
37
29
|
// non-blocking (run is blocking in c++)
|
|
38
30
|
// calling it again should not do anything
|
|
39
31
|
start() {
|
|
40
|
-
w(this, $) == null && w(this, E) !== 1 && w(this, E) !== 3 && (
|
|
41
|
-
|
|
32
|
+
w(this, $) == null && w(this, E) !== 1 && w(this, E) !== 3 && (S(this, $, new WebSocket(`ws://${w(this, N)}`)), w(this, $).binaryType = "arraybuffer", w(this, $).onopen = () => {
|
|
33
|
+
S(this, E, 1), w(this, M) && w(this, M).call(this, w(this, N));
|
|
42
34
|
}, w(this, $).onclose = () => {
|
|
43
|
-
w(this, E) === 1 && (w(this, D) && w(this, D).call(this, w(this, N)),
|
|
35
|
+
w(this, E) === 1 && (w(this, D) && w(this, D).call(this, w(this, N)), S(this, E, 2), W(this, j, I).call(this));
|
|
44
36
|
}, w(this, $).onerror = () => {
|
|
45
|
-
w(this, E) !== 1 && w(this, E) !== 3 && (
|
|
37
|
+
w(this, E) !== 1 && w(this, E) !== 3 && (S(this, E, 2), W(this, j, I).call(this));
|
|
46
38
|
}, w(this, $).onmessage = (e) => {
|
|
47
39
|
w(this, L) && w(this, L).call(this, w(this, N), new Uint8Array(e.data));
|
|
48
40
|
});
|
|
49
41
|
}
|
|
50
42
|
stop() {
|
|
51
|
-
|
|
43
|
+
S(this, E, 3), w(this, $) != null && (w(this, $).close(), S(this, $, null));
|
|
52
44
|
}
|
|
53
45
|
restart() {
|
|
54
|
-
|
|
46
|
+
S(this, E, 0);
|
|
55
47
|
}
|
|
56
48
|
publish(e) {
|
|
57
49
|
w(this, $) != null && w(this, E) == 1 && w(this, $).send(e);
|
|
@@ -60,7 +52,7 @@ let Service$1 = (U = class {
|
|
|
60
52
|
e === w(this, N) && this.publish(n);
|
|
61
53
|
}
|
|
62
54
|
}, j = new WeakSet(), I = function() {
|
|
63
|
-
w(this, $) != null && (w(this, $).close(),
|
|
55
|
+
w(this, $) != null && (w(this, $).close(), S(this, $, null)), setTimeout(() => this.start(), 1e3);
|
|
64
56
|
}, E = new WeakMap(), M = new WeakMap(), D = new WeakMap(), L = new WeakMap(), N = new WeakMap(), $ = new WeakMap(), U);
|
|
65
57
|
const header = (i) => {
|
|
66
58
|
const e = new Uint8Array(4);
|
|
@@ -2261,29 +2253,29 @@ function requireRoot() {
|
|
|
2261
2253
|
if (!m)
|
|
2262
2254
|
return f.asPromise(c, b, h, y);
|
|
2263
2255
|
var v = m === r;
|
|
2264
|
-
function p(q,
|
|
2256
|
+
function p(q, A) {
|
|
2265
2257
|
if (m) {
|
|
2266
2258
|
if (v)
|
|
2267
2259
|
throw q;
|
|
2268
2260
|
var k = m;
|
|
2269
|
-
m = null, k(q,
|
|
2261
|
+
m = null, k(q, A);
|
|
2270
2262
|
}
|
|
2271
2263
|
}
|
|
2272
2264
|
function g(q) {
|
|
2273
|
-
var
|
|
2274
|
-
if (
|
|
2275
|
-
var k = q.substring(
|
|
2265
|
+
var A = q.lastIndexOf("google/protobuf/");
|
|
2266
|
+
if (A > -1) {
|
|
2267
|
+
var k = q.substring(A);
|
|
2276
2268
|
if (k in s) return k;
|
|
2277
2269
|
}
|
|
2278
2270
|
return null;
|
|
2279
2271
|
}
|
|
2280
|
-
function _(q,
|
|
2272
|
+
function _(q, A) {
|
|
2281
2273
|
try {
|
|
2282
|
-
if (f.isString(
|
|
2283
|
-
b.setOptions(
|
|
2274
|
+
if (f.isString(A) && A.charAt(0) === "{" && (A = JSON.parse(A)), !f.isString(A))
|
|
2275
|
+
b.setOptions(A.options).addJSON(A.nested);
|
|
2284
2276
|
else {
|
|
2285
2277
|
t.filename = q;
|
|
2286
|
-
var k = t(
|
|
2278
|
+
var k = t(A, b, y), B, x = 0;
|
|
2287
2279
|
if (k.imports)
|
|
2288
2280
|
for (; x < k.imports.length; ++x)
|
|
2289
2281
|
(B = g(k.imports[x]) || b.resolvePath(q, k.imports[x])) && R(B);
|
|
@@ -2296,7 +2288,7 @@ function requireRoot() {
|
|
|
2296
2288
|
}
|
|
2297
2289
|
!v && !O && p(null, b);
|
|
2298
2290
|
}
|
|
2299
|
-
function R(q,
|
|
2291
|
+
function R(q, A) {
|
|
2300
2292
|
if (q = g(q) || q, !(b.files.indexOf(q) > -1)) {
|
|
2301
2293
|
if (b.files.push(q), q in s) {
|
|
2302
2294
|
v ? _(q, s[q]) : (++O, setTimeout(function() {
|
|
@@ -2309,7 +2301,7 @@ function requireRoot() {
|
|
|
2309
2301
|
try {
|
|
2310
2302
|
k = f.fs.readFileSync(q).toString("utf8");
|
|
2311
2303
|
} catch (B) {
|
|
2312
|
-
|
|
2304
|
+
A || p(B);
|
|
2313
2305
|
return;
|
|
2314
2306
|
}
|
|
2315
2307
|
_(q, k);
|
|
@@ -2317,7 +2309,7 @@ function requireRoot() {
|
|
|
2317
2309
|
++O, b.fetch(q, function(B, x) {
|
|
2318
2310
|
if (--O, !!m) {
|
|
2319
2311
|
if (B) {
|
|
2320
|
-
|
|
2312
|
+
A ? O || p(null, b) : p(B);
|
|
2321
2313
|
return;
|
|
2322
2314
|
}
|
|
2323
2315
|
_(q, x);
|
|
@@ -2860,29 +2852,26 @@ const protobufjs = /* @__PURE__ */ getDefaultExportFromCjs(light), proto_data =
|
|
|
2860
2852
|
};
|
|
2861
2853
|
};
|
|
2862
2854
|
}, create_action = async ({ server: i, cdn_url: e, frame: n, tag: a }) => {
|
|
2863
|
-
const f = async (
|
|
2864
|
-
const
|
|
2865
|
-
|
|
2866
|
-
({ frame:
|
|
2855
|
+
const f = async (t) => {
|
|
2856
|
+
const s = await Promise.all(
|
|
2857
|
+
t.map(
|
|
2858
|
+
({ frame: o, tag: r }) => create_action({
|
|
2867
2859
|
server: i,
|
|
2868
2860
|
cdn_url: e,
|
|
2869
|
-
frame:
|
|
2870
|
-
tag:
|
|
2861
|
+
frame: o,
|
|
2862
|
+
tag: r
|
|
2871
2863
|
})
|
|
2872
2864
|
)
|
|
2873
2865
|
);
|
|
2874
|
-
return (
|
|
2875
|
-
const
|
|
2876
|
-
return { destroy: () =>
|
|
2866
|
+
return (o) => {
|
|
2867
|
+
const r = s.map((l) => l(o));
|
|
2868
|
+
return { destroy: () => r.forEach(({ destroy: l }) => l()) };
|
|
2877
2869
|
};
|
|
2878
|
-
}, t = await create_app(i, n, a ?? null, e, {
|
|
2879
|
-
one: (s, o) => f([{ frame: s, tag: o }]),
|
|
2880
|
-
all: (s) => f(s)
|
|
2881
|
-
});
|
|
2882
|
-
return (s) => {
|
|
2883
|
-
const o = mount(ActionLoader, { target: s, props: { action: t } });
|
|
2884
|
-
return { destroy: () => unmount(o) };
|
|
2885
2870
|
};
|
|
2871
|
+
return create_app(i, n, a ?? null, e, {
|
|
2872
|
+
one: (t, s) => f([{ frame: t, tag: s }]),
|
|
2873
|
+
all: (t) => f(t)
|
|
2874
|
+
});
|
|
2886
2875
|
}, create_component = async (i, e) => (await create_action(e))(i);
|
|
2887
2876
|
export {
|
|
2888
2877
|
create_component
|