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.
Files changed (39) hide show
  1. package/README.md +77 -11
  2. package/api/global.d.ts +27 -0
  3. package/api/index.d.ts +37 -0
  4. package/api/index.js +35 -0
  5. package/bin/janela.mjs +21 -4
  6. package/package.json +15 -1
  7. package/runtime/janela.ts +138 -134
  8. package/runtime/types.ts +131 -0
  9. package/shim/wvshim.cc +55 -8
  10. package/templates/index.html +4 -2
  11. package/templates/main.ts +1 -1
  12. package/templates/react/deps.json +14 -2
  13. package/templates/react/files/index.html +1 -1
  14. package/templates/react/files/src/{App.jsx → App.tsx} +19 -8
  15. package/templates/react/files/src/main.tsx +12 -0
  16. package/templates/react/files/src-host/main.ts +1 -1
  17. package/templates/react/files/tsconfig.json +25 -0
  18. package/templates/solid/deps.json +11 -2
  19. package/templates/solid/files/index.html +1 -1
  20. package/templates/solid/files/src/App.tsx +50 -0
  21. package/templates/solid/files/src/main.tsx +7 -0
  22. package/templates/solid/files/src-host/main.ts +1 -1
  23. package/templates/solid/files/tsconfig.json +26 -0
  24. package/templates/svelte/deps.json +6 -1
  25. package/templates/svelte/files/index.html +1 -1
  26. package/templates/svelte/files/src/App.svelte +10 -7
  27. package/templates/svelte/files/src/main.ts +7 -0
  28. package/templates/svelte/files/src-host/main.ts +1 -1
  29. package/templates/svelte/files/tsconfig.json +23 -0
  30. package/templates/vue/deps.json +12 -2
  31. package/templates/vue/files/index.html +1 -1
  32. package/templates/vue/files/src/App.vue +9 -7
  33. package/templates/vue/files/src-host/main.ts +1 -1
  34. package/templates/vue/files/tsconfig.json +23 -0
  35. package/templates/react/files/src/main.jsx +0 -9
  36. package/templates/solid/files/src/App.jsx +0 -35
  37. package/templates/solid/files/src/main.jsx +0 -4
  38. package/templates/svelte/files/src/main.js +0 -4
  39. /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,9 +0,0 @@
1
- import { StrictMode } from "react";
2
- import { createRoot } from "react-dom/client";
3
- import App from "./App.jsx";
4
-
5
- createRoot(document.getElementById("root")).render(
6
- <StrictMode>
7
- <App />
8
- </StrictMode>,
9
- );
@@ -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
- }
@@ -1,4 +0,0 @@
1
- import { render } from "solid-js/web";
2
- import App from "./App.jsx";
3
-
4
- render(() => <App />, document.getElementById("root"));
@@ -1,4 +0,0 @@
1
- import { mount } from "svelte";
2
- import App from "./App.svelte";
3
-
4
- mount(App, { target: document.getElementById("app") });
File without changes