@nil-/xit 0.1.25 → 0.1.26
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/index.js +3 -1
- package/index.d.ts +8 -6
- package/index.js +5 -3
- package/package.json +1 -1
package/assets/index.js
CHANGED
|
@@ -2870,7 +2870,9 @@ const protobufjs = /* @__PURE__ */ getDefaultExportFromCjs(light), proto_data =
|
|
|
2870
2870
|
frame_ui: f,
|
|
2871
2871
|
frame: a,
|
|
2872
2872
|
resub: () => t.start(),
|
|
2873
|
-
unsub: () => t.stop()
|
|
2873
|
+
unsub: () => t.stop(),
|
|
2874
|
+
id: e,
|
|
2875
|
+
tag: n
|
|
2874
2876
|
});
|
|
2875
2877
|
const { destroy: m } = h(c, p);
|
|
2876
2878
|
return {
|
package/index.d.ts
CHANGED
|
@@ -16,7 +16,7 @@ export type Values = {
|
|
|
16
16
|
number: (t: string, v: number) => Writable<number>;
|
|
17
17
|
string: (t: string, v: string) => Writable<string>;
|
|
18
18
|
buffer: (t: string, v: Uint8Array) => Writable<Uint8Array>;
|
|
19
|
-
json: <T
|
|
19
|
+
json: <T>(t: string, v: T, codec: CoDec<T>) => Writable<T>;
|
|
20
20
|
};
|
|
21
21
|
export type Signals = {
|
|
22
22
|
none: (t: string) => () => void;
|
|
@@ -25,7 +25,7 @@ export type Signals = {
|
|
|
25
25
|
number: (t: string) => (v: number) => void;
|
|
26
26
|
string: (t: string) => (v: string) => void;
|
|
27
27
|
buffer: (t: string) => (v: Uint8Array) => void;
|
|
28
|
-
json: <T,
|
|
28
|
+
json: <T>(t: string, encoder: CoDec<T>["encode"]) => (v: T) => void;
|
|
29
29
|
};
|
|
30
30
|
export type Frame = {
|
|
31
31
|
values: Values;
|
|
@@ -36,13 +36,15 @@ export type Frame = {
|
|
|
36
36
|
export type Context = {
|
|
37
37
|
values: Values;
|
|
38
38
|
signals: Signals;
|
|
39
|
-
frame_ui: (f: string, tag?: string) => Promise<Action<
|
|
39
|
+
frame_ui: (f: string, tag?: string) => Promise<Action<HTMLElement>>;
|
|
40
40
|
frame: (f: string, tag?: string) => Promise<Frame>;
|
|
41
41
|
resub: () => void;
|
|
42
42
|
unsub: () => void;
|
|
43
|
+
id: string;
|
|
44
|
+
tag: string | null;
|
|
43
45
|
};
|
|
44
|
-
export declare const json_string: {
|
|
45
|
-
encode:
|
|
46
|
-
decode:
|
|
46
|
+
export declare const json_string: <T>() => {
|
|
47
|
+
encode: (o: T) => Uint8Array;
|
|
48
|
+
decode: (o: Uint8Array) => any;
|
|
47
49
|
};
|
|
48
50
|
export declare const xit: () => Context;
|
package/index.js
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { getContext } from "svelte";
|
|
2
|
-
export const json_string = {
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
export const json_string = () => {
|
|
3
|
+
return {
|
|
4
|
+
encode: (o) => new TextEncoder().encode(JSON.stringify(o)),
|
|
5
|
+
decode: (o) => JSON.parse(new TextDecoder().decode(o))
|
|
6
|
+
};
|
|
5
7
|
};
|
|
6
8
|
export const xit = () => {
|
|
7
9
|
return getContext("nil.xit");
|