@nil-/xit 0.4.11 → 0.4.13
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 +1 -1
- package/components/layouts/Container.svelte +3 -1
- package/components/layouts/Scrollable.svelte +2 -1
- package/components/layouts/Split.svelte +70 -44
- package/components/loaders/Helpers.d.ts +9 -8
- package/components/loaders/Reactive.svelte +54 -40
- package/components/loaders/ReadOnly.svelte +75 -49
- package/components/utilities/DividerOverlay.svelte +7 -4
- package/package.json +2 -3
- package/test/Frame.svelte +83 -58
- package/test/Main.svelte +12 -6
- package/components/loaders/FFF.svelte +0 -45
- package/components/loaders/FFF.svelte.d.ts +0 -18
- package/components/loaders/Reactive.svelte.d.ts +0 -3916
- package/components/loaders/ReadOnly.svelte.d.ts +0 -3916
package/test/Frame.svelte
CHANGED
|
@@ -1,63 +1,88 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { xit, type CoDec, type Action } from "..";
|
|
3
|
+
import { get } from "svelte/store";
|
|
4
|
+
|
|
5
|
+
import type { Snippet } from "svelte";
|
|
6
|
+
|
|
7
|
+
type ActionItem = { name: string; action: Action<HTMLElement> };
|
|
8
|
+
|
|
9
|
+
let {
|
|
10
|
+
decoder,
|
|
11
|
+
selected = -1,
|
|
12
|
+
load
|
|
13
|
+
}: {
|
|
14
|
+
decoder: CoDec<any>["decode"];
|
|
15
|
+
selected?: number;
|
|
16
|
+
load: Snippet<
|
|
17
|
+
[
|
|
18
|
+
{
|
|
19
|
+
tags: string[];
|
|
20
|
+
inputs: ActionItem[];
|
|
21
|
+
outputs: ActionItem[];
|
|
22
|
+
}
|
|
23
|
+
]
|
|
24
|
+
>;
|
|
25
|
+
} = $props();
|
|
26
|
+
|
|
27
|
+
let { signals, values, load_frame_data, load_frame_ui } = xit();
|
|
28
|
+
|
|
29
|
+
const frame_info = async (tag: string, decoder: CoDec<any>["decode"]) => {
|
|
30
|
+
const { values, unsub } = await load_frame_data("frame_info", tag);
|
|
31
|
+
const load = async (key: string) => {
|
|
32
|
+
const v = values.json(key, [] as string[], {
|
|
33
|
+
decode: decoder,
|
|
34
|
+
encode: () => {
|
|
35
|
+
return new Uint8Array();
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
return Promise.all(
|
|
39
|
+
get(v)
|
|
40
|
+
.map((v) => {
|
|
41
|
+
const [frame_id, mark, g] = v.split(":");
|
|
42
|
+
if (g !== "V") {
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
if (mark === "T") {
|
|
46
|
+
return load_frame_ui(frame_id, tag).then((f) => {
|
|
47
|
+
return { name: frame_id, action: f };
|
|
48
|
+
});
|
|
49
|
+
} else if (mark === "U") {
|
|
50
|
+
return load_frame_ui(frame_id).then((f) => {
|
|
51
|
+
return { name: frame_id, action: f };
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
})
|
|
55
|
+
.filter((v) => v != null)
|
|
56
|
+
);
|
|
57
|
+
};
|
|
58
|
+
const [inputs, outputs] = await Promise.all([load("inputs"), load("outputs")]);
|
|
59
|
+
unsub();
|
|
60
|
+
return { inputs, outputs };
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
const tags = values.json("tags", [] as string[], {
|
|
64
|
+
decode: decoder,
|
|
65
|
+
encode: () => new Uint8Array()
|
|
17
66
|
});
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
});
|
|
67
|
+
const finalize = signals.string("finalize");
|
|
68
|
+
|
|
69
|
+
let a_inputs = $state([] as { name: string; action: Action<HTMLElement> }[]);
|
|
70
|
+
let a_outputs = $state([] as { name: string; action: Action<HTMLElement> }[]);
|
|
71
|
+
let title = $derived(selected > $tags.length ? "" : $tags[selected]);
|
|
72
|
+
const update = async (v: number) => {
|
|
73
|
+
a_inputs = [];
|
|
74
|
+
a_outputs = [];
|
|
75
|
+
const t = $tags;
|
|
76
|
+
if (0 <= v && v < t.length) {
|
|
77
|
+
const { inputs, outputs } = await frame_info(t[v], decoder);
|
|
78
|
+
a_inputs = inputs;
|
|
79
|
+
a_outputs = outputs;
|
|
32
80
|
}
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
return { inputs, outputs };
|
|
39
|
-
};
|
|
40
|
-
const tags = values.json("tags", [], {
|
|
41
|
-
decode: decoder,
|
|
42
|
-
encode: () => new Uint8Array()
|
|
43
|
-
});
|
|
44
|
-
const finalize = signals.string("finalize");
|
|
45
|
-
let a_inputs = $state([]);
|
|
46
|
-
let a_outputs = $state([]);
|
|
47
|
-
let title = $derived(selected > $tags.length ? "" : $tags[selected]);
|
|
48
|
-
const update = async (v) => {
|
|
49
|
-
a_inputs = [];
|
|
50
|
-
a_outputs = [];
|
|
51
|
-
const t = $tags;
|
|
52
|
-
if (0 <= v && v < t.length) {
|
|
53
|
-
const { inputs, outputs } = await frame_info(t[v], decoder);
|
|
54
|
-
a_inputs = inputs;
|
|
55
|
-
a_outputs = outputs;
|
|
56
|
-
}
|
|
57
|
-
};
|
|
58
|
-
$effect(() => {
|
|
59
|
-
update(selected);
|
|
60
|
-
});
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
$effect(() => {
|
|
84
|
+
update(selected);
|
|
85
|
+
});
|
|
61
86
|
</script>
|
|
62
87
|
|
|
63
88
|
<svelte:head>
|
package/test/Main.svelte
CHANGED
|
@@ -1,9 +1,15 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import TestFrame from "./Frame.svelte";
|
|
3
|
+
import Split from "../components/layouts/Split.svelte";
|
|
4
|
+
import Scrollable from "../components/layouts/Scrollable.svelte";
|
|
5
|
+
|
|
6
|
+
import type { Snippet } from "svelte";
|
|
7
|
+
|
|
8
|
+
import { config } from "$xit/config.js";
|
|
9
|
+
|
|
10
|
+
let { children }: { children?: Snippet<[string]> } = $props();
|
|
11
|
+
|
|
12
|
+
let selected = $state(-1);
|
|
7
13
|
</script>
|
|
8
14
|
|
|
9
15
|
{#snippet combo(tags: string[])}
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
<script lang="ts">import ReadOnlyValueLoader from "./ReadOnly.svelte";
|
|
2
|
-
import ReactiveValueLoader from "./Reactive.svelte";
|
|
3
|
-
import { json_string } from "../..";
|
|
4
|
-
const CurrentComponent = ReadOnlyValueLoader;
|
|
5
|
-
</script>
|
|
6
|
-
|
|
7
|
-
<CurrentComponent
|
|
8
|
-
frames={[
|
|
9
|
-
{
|
|
10
|
-
id: "id1",
|
|
11
|
-
items: [
|
|
12
|
-
{
|
|
13
|
-
type: "boolean",
|
|
14
|
-
default: true,
|
|
15
|
-
key: "hhello"
|
|
16
|
-
},
|
|
17
|
-
{
|
|
18
|
-
type: "boolean",
|
|
19
|
-
default: false,
|
|
20
|
-
key: "hhello1"
|
|
21
|
-
}
|
|
22
|
-
]
|
|
23
|
-
},
|
|
24
|
-
{
|
|
25
|
-
id: "id1",
|
|
26
|
-
items: [
|
|
27
|
-
{
|
|
28
|
-
type: "json",
|
|
29
|
-
default: 123,
|
|
30
|
-
key: "hhello",
|
|
31
|
-
codec: json_string
|
|
32
|
-
},
|
|
33
|
-
{
|
|
34
|
-
type: "number",
|
|
35
|
-
default: 1,
|
|
36
|
-
key: "hhello1"
|
|
37
|
-
}
|
|
38
|
-
]
|
|
39
|
-
}
|
|
40
|
-
]}
|
|
41
|
-
>
|
|
42
|
-
{#snippet loaded_data(data)}
|
|
43
|
-
asd
|
|
44
|
-
{/snippet}
|
|
45
|
-
</CurrentComponent>
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
|
|
2
|
-
new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
|
|
3
|
-
$$bindings?: Bindings;
|
|
4
|
-
} & Exports;
|
|
5
|
-
(internal: unknown, props: {
|
|
6
|
-
$$events?: Events;
|
|
7
|
-
$$slots?: Slots;
|
|
8
|
-
}): Exports & {
|
|
9
|
-
$set?: any;
|
|
10
|
-
$on?: any;
|
|
11
|
-
};
|
|
12
|
-
z_$$bindings?: Bindings;
|
|
13
|
-
}
|
|
14
|
-
declare const Fff: $$__sveltets_2_IsomorphicComponent<Record<string, never>, {
|
|
15
|
-
[evt: string]: CustomEvent<any>;
|
|
16
|
-
}, {}, {}, string>;
|
|
17
|
-
type Fff = InstanceType<typeof Fff>;
|
|
18
|
-
export default Fff;
|