janela 0.3.0 → 0.4.0
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/README.md +77 -11
- package/api/global.d.ts +27 -0
- package/api/index.d.ts +37 -0
- package/api/index.js +35 -0
- package/bin/janela.mjs +21 -4
- package/package.json +15 -1
- package/runtime/janela.ts +138 -134
- package/runtime/types.ts +131 -0
- package/shim/wvshim.cc +55 -8
- package/templates/index.html +4 -2
- package/templates/main.ts +1 -1
- package/templates/react/deps.json +14 -2
- package/templates/react/files/index.html +1 -1
- package/templates/react/files/src/{App.jsx → App.tsx} +19 -8
- package/templates/react/files/src/main.tsx +12 -0
- package/templates/react/files/src-host/main.ts +1 -1
- package/templates/react/files/tsconfig.json +25 -0
- package/templates/solid/deps.json +11 -2
- package/templates/solid/files/index.html +1 -1
- package/templates/solid/files/src/App.tsx +50 -0
- package/templates/solid/files/src/main.tsx +7 -0
- package/templates/solid/files/src-host/main.ts +1 -1
- package/templates/solid/files/tsconfig.json +26 -0
- package/templates/svelte/deps.json +6 -1
- package/templates/svelte/files/index.html +1 -1
- package/templates/svelte/files/src/App.svelte +10 -7
- package/templates/svelte/files/src/main.ts +7 -0
- package/templates/svelte/files/src-host/main.ts +1 -1
- package/templates/svelte/files/tsconfig.json +23 -0
- package/templates/vue/deps.json +12 -2
- package/templates/vue/files/index.html +1 -1
- package/templates/vue/files/src/App.vue +9 -7
- package/templates/vue/files/src-host/main.ts +1 -1
- package/templates/vue/files/tsconfig.json +23 -0
- package/templates/react/files/src/main.jsx +0 -9
- package/templates/solid/files/src/App.jsx +0 -35
- package/templates/solid/files/src/main.jsx +0 -4
- package/templates/svelte/files/src/main.js +0 -4
- /package/templates/vue/files/src/{main.js → main.ts} +0 -0
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "ES2022",
|
|
4
|
+
"module": "ESNext",
|
|
5
|
+
"moduleResolution": "bundler",
|
|
6
|
+
"lib": [
|
|
7
|
+
"ES2022",
|
|
8
|
+
"DOM",
|
|
9
|
+
"DOM.Iterable"
|
|
10
|
+
],
|
|
11
|
+
"types": [],
|
|
12
|
+
"strict": true,
|
|
13
|
+
"noEmit": true,
|
|
14
|
+
"skipLibCheck": true,
|
|
15
|
+
"isolatedModules": true,
|
|
16
|
+
"verbatimModuleSyntax": true
|
|
17
|
+
},
|
|
18
|
+
"include": [
|
|
19
|
+
"src/**/*.ts",
|
|
20
|
+
"src/**/*.vue",
|
|
21
|
+
"src-host/**/*.ts"
|
|
22
|
+
]
|
|
23
|
+
}
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { createSignal, onMount, For, Show } from "solid-js";
|
|
2
|
-
import "./App.css";
|
|
3
|
-
|
|
4
|
-
export default function App() {
|
|
5
|
-
const [greeting, setGreeting] = createSignal("…");
|
|
6
|
-
const [a, setA] = createSignal(2);
|
|
7
|
-
const [b, setB] = createSignal(40);
|
|
8
|
-
const [sum, setSum] = createSignal(null);
|
|
9
|
-
const [events, setEvents] = createSignal([]);
|
|
10
|
-
|
|
11
|
-
// Backend→frontend events. The payload arrives as a value.
|
|
12
|
-
janela.listen("added", (value) =>
|
|
13
|
-
setEvents((prev) => [`host emitted: ${value}`, ...prev]),
|
|
14
|
-
);
|
|
15
|
-
|
|
16
|
-
onMount(async () => setGreeting(await janela.invoke("greet", { name: "__NAME__" })));
|
|
17
|
-
|
|
18
|
-
const add = async () =>
|
|
19
|
-
setSum(await janela.invoke("add", { a: Number(a()), b: Number(b()) }));
|
|
20
|
-
|
|
21
|
-
return (
|
|
22
|
-
<>
|
|
23
|
-
<h1>{greeting()}</h1>
|
|
24
|
-
<p>
|
|
25
|
-
<input type="number" value={a()} onInput={(e) => setA(e.currentTarget.value)} /> +
|
|
26
|
-
<input type="number" value={b()} onInput={(e) => setB(e.currentTarget.value)} />
|
|
27
|
-
<button onClick={add}>add</button>
|
|
28
|
-
<Show when={sum() !== null}><span> = {sum()}</span></Show>
|
|
29
|
-
</p>
|
|
30
|
-
<ul>
|
|
31
|
-
<For each={events()}>{(e) => <li>{e}</li>}</For>
|
|
32
|
-
</ul>
|
|
33
|
-
</>
|
|
34
|
-
);
|
|
35
|
-
}
|
|
File without changes
|