@nil-/xit 0.2.2 → 0.2.4

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.
@@ -1,2 +1,3 @@
1
- const e = "5";
2
- typeof window < "u" && (window.__svelte || (window.__svelte = { v: /* @__PURE__ */ new Set() })).v.add(e);
1
+ const d = "5";
2
+ var e;
3
+ typeof window < "u" && ((e = window.__svelte ?? (window.__svelte = {})).v ?? (e.v = /* @__PURE__ */ new Set())).add(d);
@@ -4,7 +4,7 @@ var et = (e) => {
4
4
  var X = (e, t, s) => t.has(e) || et("Cannot " + s);
5
5
  var r = (e, t, s) => (X(e, t, "read from private field"), s ? s.call(e) : t.get(e)), a = (e, t, s) => t.has(e) ? et("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(e) : t.set(e, s), h = (e, t, s, n) => (X(e, t, "write to private field"), n ? n.call(e, s) : t.set(e, s), s), st = (e, t, s) => (X(e, t, "access private method"), s);
6
6
  import "./internal/client.js";
7
- import { o as dt, c as S, b as rt, a as g, f as ut, n as lt, g as _ } from "./index.js";
7
+ import { o as dt, b as S, c as rt, a as g, k as ut, n as lt, g as _ } from "./index.js";
8
8
  import { c as mt, w as nt } from "./store.js";
9
9
  import { linear as it } from "./easing.js";
10
10
  const pt = () => performance.now(), l = {
@@ -1,168 +1,173 @@
1
- import { n as l, u as h, s as z, r as j, a as A, e as m, g as O, b as S, t as B, c as C, d as E } from "./index.js";
1
+ import { n as l, u as w, s as B, r as C, a as E, e as j, g as M, b as P, c as k, t as T, d as y, f as h, h as m, i as S, j as $ } from "./index.js";
2
2
  import "./internal/client.js";
3
- function v(e, r, t) {
3
+ function q(e, r, n) {
4
4
  if (e == null)
5
- return r(void 0), t && t(void 0), l;
6
- const n = h(
5
+ return r(void 0), n && n(void 0), l;
6
+ const t = w(
7
7
  () => e.subscribe(
8
8
  r,
9
9
  // @ts-expect-error
10
- t
10
+ n
11
11
  )
12
12
  );
13
- return n.unsubscribe ? () => n.unsubscribe() : n;
13
+ return t.unsubscribe ? () => t.unsubscribe() : t;
14
14
  }
15
- const a = [];
16
- function w(e, r) {
15
+ const b = [];
16
+ function x(e, r) {
17
17
  return {
18
- subscribe: g(e, r).subscribe
18
+ subscribe: v(e, r).subscribe
19
19
  };
20
20
  }
21
- function g(e, r = l) {
22
- let t = null;
23
- const n = /* @__PURE__ */ new Set();
24
- function s(i) {
25
- if (z(e, i) && (e = i, t)) {
26
- const f = !a.length;
27
- for (const u of n)
28
- u[1](), a.push(u, e);
29
- if (f) {
30
- for (let u = 0; u < a.length; u += 2)
31
- a[u][0](a[u + 1]);
32
- a.length = 0;
21
+ function v(e, r = l) {
22
+ let n = null;
23
+ const t = /* @__PURE__ */ new Set();
24
+ function i(u) {
25
+ if (B(e, u) && (e = u, n)) {
26
+ const a = !b.length;
27
+ for (const s of t)
28
+ s[1](), b.push(s, e);
29
+ if (a) {
30
+ for (let s = 0; s < b.length; s += 2)
31
+ b[s][0](b[s + 1]);
32
+ b.length = 0;
33
33
  }
34
34
  }
35
35
  }
36
- function c(i) {
37
- s(i(
36
+ function c(u) {
37
+ i(u(
38
38
  /** @type {T} */
39
39
  e
40
40
  ));
41
41
  }
42
- function o(i, f = l) {
43
- const u = [i, f];
44
- return n.add(u), n.size === 1 && (t = r(s, c) || l), i(
42
+ function o(u, a = l) {
43
+ const s = [u, a];
44
+ return t.add(s), t.size === 1 && (n = r(i, c) || l), u(
45
45
  /** @type {T} */
46
46
  e
47
47
  ), () => {
48
- n.delete(u), n.size === 0 && t && (t(), t = null);
48
+ t.delete(s), t.size === 0 && n && (n(), n = null);
49
49
  };
50
50
  }
51
- return { set: s, update: c, subscribe: o };
51
+ return { set: i, update: c, subscribe: o };
52
52
  }
53
- function M(e, r, t) {
54
- const n = !Array.isArray(e), s = n ? [e] : e;
55
- if (!s.every(Boolean))
53
+ function D(e, r, n) {
54
+ const t = !Array.isArray(e), i = t ? [e] : e;
55
+ if (!i.every(Boolean))
56
56
  throw new Error("derived() expects stores as input, got a falsy value");
57
57
  const c = r.length < 2;
58
- return w(t, (o, i) => {
59
- let f = !1;
60
- const u = [];
61
- let d = 0, p = l;
62
- const y = () => {
58
+ return x(n, (o, u) => {
59
+ let a = !1;
60
+ const s = [];
61
+ let d = 0, _ = l;
62
+ const g = () => {
63
63
  if (d)
64
64
  return;
65
- p();
66
- const b = r(n ? u[0] : u, o, i);
67
- c ? o(b) : p = typeof b == "function" ? b : l;
68
- }, q = s.map(
69
- (b, _) => v(
70
- b,
71
- (x) => {
72
- u[_] = x, d &= ~(1 << _), f && y();
65
+ _();
66
+ const f = r(t ? s[0] : s, o, u);
67
+ c ? o(f) : _ = typeof f == "function" ? f : l;
68
+ }, A = i.map(
69
+ (f, p) => q(
70
+ f,
71
+ (O) => {
72
+ s[p] = O, d &= ~(1 << p), a && g();
73
73
  },
74
74
  () => {
75
- d |= 1 << _;
75
+ d |= 1 << p;
76
76
  }
77
77
  )
78
78
  );
79
- return f = !0, y(), function() {
80
- j(q), p(), f = !1;
79
+ return a = !0, g(), function() {
80
+ C(A), _(), a = !1;
81
81
  };
82
82
  });
83
83
  }
84
- function P(e) {
84
+ function F(e) {
85
85
  return {
86
86
  // @ts-expect-error TODO i suspect the bind is unnecessary
87
87
  subscribe: e.subscribe.bind(e)
88
88
  };
89
89
  }
90
- function k(e) {
90
+ function z(e) {
91
91
  let r;
92
- return v(e, (t) => r = t)(), r;
92
+ return q(e, (n) => r = n)(), r;
93
93
  }
94
- function T(e) {
95
- A(e, e.v + 1);
94
+ function G(e) {
95
+ E(e, e.v + 1);
96
96
  }
97
- function $(e) {
98
- let r = 0, t = C(0), n;
97
+ function H(e) {
98
+ let r = 0, n = P(0), t;
99
99
  return () => {
100
- m() && (O(t), S(() => (r === 0 && (n = h(() => e(() => T(t)))), r += 1, () => {
101
- B().then(() => {
102
- r -= 1, r === 0 && (n == null || n(), n = void 0);
100
+ j() && (M(n), k(() => (r === 0 && (t = w(() => e(() => G(n)))), r += 1, () => {
101
+ T().then(() => {
102
+ r -= 1, r === 0 && (t == null || t(), t = void 0);
103
103
  });
104
104
  })));
105
105
  };
106
106
  }
107
- function D(e, r) {
108
- let t = e();
109
- const n = g(t, (s) => {
110
- let c = t !== e();
111
- const o = E(() => {
112
- S(() => {
113
- const i = e();
114
- c && s(i);
107
+ function I(e, r) {
108
+ var n = S, t = h, i = e();
109
+ const c = v(i, (o) => {
110
+ var u = i !== e(), a, s = h, d = S;
111
+ y(t), m(n);
112
+ try {
113
+ a = $(() => {
114
+ k(() => {
115
+ const _ = e();
116
+ u && o(_);
117
+ });
115
118
  });
116
- });
117
- return c = !0, o;
119
+ } finally {
120
+ y(s), m(d);
121
+ }
122
+ return u = !0, a;
118
123
  });
119
124
  return r ? {
120
125
  set: r,
121
- update: (s) => r(s(e())),
122
- subscribe: n.subscribe
126
+ update: (o) => r(o(e())),
127
+ subscribe: c.subscribe
123
128
  } : {
124
- subscribe: n.subscribe
129
+ subscribe: c.subscribe
125
130
  };
126
131
  }
127
- function F(e) {
132
+ function J(e) {
128
133
  let r;
129
- const t = $((s) => {
134
+ const n = H((i) => {
130
135
  let c = !1;
131
- const o = e.subscribe((i) => {
132
- r = i, c && s();
136
+ const o = e.subscribe((u) => {
137
+ r = u, c && i();
133
138
  });
134
139
  return c = !0, o;
135
140
  });
136
- function n() {
137
- return m() ? (t(), r) : k(e);
141
+ function t() {
142
+ return j() ? (n(), r) : z(e);
138
143
  }
139
144
  return "set" in e ? {
140
145
  get current() {
141
- return n();
146
+ return t();
142
147
  },
143
- set current(s) {
144
- e.set(s);
148
+ set current(i) {
149
+ e.set(i);
145
150
  }
146
151
  } : {
147
152
  get current() {
148
- return n();
153
+ return t();
149
154
  }
150
155
  };
151
156
  }
152
- const I = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
157
+ const N = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
153
158
  __proto__: null,
154
- derived: M,
155
- fromStore: F,
156
- get: k,
157
- readable: w,
158
- readonly: P,
159
- toStore: D,
160
- writable: g
159
+ derived: D,
160
+ fromStore: J,
161
+ get: z,
162
+ readable: x,
163
+ readonly: F,
164
+ toStore: I,
165
+ writable: v
161
166
  }, Symbol.toStringTag, { value: "Module" }));
162
167
  export {
163
- $ as c,
164
- k as g,
165
- I as i,
166
- v as s,
167
- g as w
168
+ H as c,
169
+ z as g,
170
+ N as i,
171
+ q as s,
172
+ v as w
168
173
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nil-/xit",
3
- "version": "0.2.2",
3
+ "version": "0.2.4",
4
4
  "peerDependencies": {
5
5
  "svelte": "^5.7.1"
6
6
  },
@@ -11,6 +11,10 @@
11
11
  "types": "./index.d.ts",
12
12
  "default": "./index.js"
13
13
  },
14
+ "./test": {
15
+ "types": "./test.d.ts",
16
+ "default": "./test.js"
17
+ },
14
18
  "./components/layouts/Container.svelte": {
15
19
  "types": "./components/layouts/Container.svelte.d.ts",
16
20
  "svelte": "./components/layouts/Container.svelte"
@@ -31,8 +35,5 @@
31
35
  "types": "./components/utilities/draggable.d.ts",
32
36
  "default": "./components/utilities/draggable.js"
33
37
  }
34
- },
35
- "dependencies": {
36
- "flatbuffers": "^25.1.24"
37
38
  }
38
39
  }
package/test.d.ts ADDED
@@ -0,0 +1,8 @@
1
+ import type { CoDec } from "./index";
2
+ export declare const xit_test: () => {
3
+ xit: import("./index").Context;
4
+ frame_info: (tag: string, decoder: CoDec<any>["decode"]) => Promise<{
5
+ inputs: import("./index").Action<HTMLElement>[];
6
+ outputs: import("./index").Action<HTMLElement>[];
7
+ }>;
8
+ };
package/test.js ADDED
@@ -0,0 +1,31 @@
1
+ import { xit } from "./index";
2
+ import { get } from "svelte/store";
3
+ export const xit_test = () => {
4
+ const x = xit();
5
+ return {
6
+ xit: x,
7
+ frame_info: async (tag, decoder) => {
8
+ const { values, unsub } = await x.frame("frame_info", tag);
9
+ const load = async (key) => {
10
+ const v = values.json(key, [], { decode: decoder, encode: () => { return new Uint8Array(); } });
11
+ return Promise.all(get(v)
12
+ .map(v => {
13
+ const [frame_id, mark, g] = v.split(":");
14
+ if (g !== "V") {
15
+ return;
16
+ }
17
+ if (mark === "T") {
18
+ return x.frame_ui(frame_id, tag);
19
+ }
20
+ else if (mark === "U") {
21
+ return x.frame_ui(frame_id);
22
+ }
23
+ })
24
+ .filter(v => v != null));
25
+ };
26
+ const [inputs, outputs] = await Promise.all([load("inputs"), load("outputs")]);
27
+ unsub();
28
+ return { inputs, outputs };
29
+ }
30
+ };
31
+ };