janela 0.18.0 → 0.19.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/bin/lib.mjs +3 -0
- package/package.json +1 -1
- package/runtime/ios.ts +128 -0
- package/runtime/janela.ts +108 -32
- package/shim/wvshim.cc +1294 -235
- package/templates/main.ts +19 -0
- package/templates/react/files/src/vite-env.d.ts +7 -0
- package/templates/react/files/src-host/main.ts +19 -0
- package/templates/react/files/tsconfig.json +1 -0
- package/templates/solid/files/src/vite-env.d.ts +7 -0
- package/templates/solid/files/src-host/main.ts +19 -0
- package/templates/solid/files/tsconfig.json +1 -0
- package/templates/svelte/files/src/vite-env.d.ts +7 -0
- package/templates/svelte/files/src-host/main.ts +19 -0
- package/templates/svelte/files/tsconfig.json +1 -0
- package/templates/vue/files/src/vite-env.d.ts +7 -0
- package/templates/vue/files/src-host/main.ts +19 -0
- package/templates/vue/files/tsconfig.json +1 -0
package/templates/main.ts
CHANGED
|
@@ -9,8 +9,27 @@
|
|
|
9
9
|
// against it; see `janela init --template vue`.
|
|
10
10
|
|
|
11
11
|
import type { JanelaApp } from "janela/host";
|
|
12
|
+
import { menuItem, menuSeparator, submenu, predefined } from "janela/host";
|
|
12
13
|
|
|
13
14
|
export function setup(app: JanelaApp): void {
|
|
15
|
+
// A menu bar. Items carry their own handlers — there are no ids to declare
|
|
16
|
+
// or match — and `predefined` is the platform's own behaviour, callable like
|
|
17
|
+
// any other function.
|
|
18
|
+
//
|
|
19
|
+
// On macOS the standard submenus (App, Edit, View, Window) are kept around
|
|
20
|
+
// whatever you declare here, so this adds File without costing the app ⌘Q or
|
|
21
|
+
// ⌘V. Windows and Linux need no such floor: their editing keys belong to the
|
|
22
|
+
// webview, and Alt+F4 to the window manager.
|
|
23
|
+
app.setMenu([
|
|
24
|
+
submenu("File", [
|
|
25
|
+
menuItem("Say hello", "CmdOrCtrl+G", () => {
|
|
26
|
+
console.log("[host] hello from the menu");
|
|
27
|
+
}),
|
|
28
|
+
menuSeparator(),
|
|
29
|
+
menuItem("Close", "CmdOrCtrl+W", () => predefined.close()),
|
|
30
|
+
]),
|
|
31
|
+
]);
|
|
32
|
+
|
|
14
33
|
app.command("greet", (args) => {
|
|
15
34
|
const a = args as { name: string };
|
|
16
35
|
return "Hello, " + a.name + "! You've been greeted from a native TypeScript binary.";
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/// <reference types="vite/client" />
|
|
2
|
+
//
|
|
3
|
+
// Declares the modules Vite lets you import that TypeScript otherwise knows
|
|
4
|
+
// nothing about — `./styles.css` most immediately, plus `import.meta.env` and
|
|
5
|
+
// asset imports. Without it a side-effect CSS import is an error in any editor
|
|
6
|
+
// running `noUncheckedSideEffectImports` (TypeScript 5.6+), which is exactly
|
|
7
|
+
// what a red squiggle on line 1 of main.ts turns out to be.
|
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
// returns `null`; every command answers the page's promise with a value.
|
|
11
11
|
|
|
12
12
|
import type { JanelaApp } from "janela/host";
|
|
13
|
+
import { menuItem, menuSeparator, submenu, predefined } from "janela/host";
|
|
13
14
|
|
|
14
15
|
/** Every command this app answers. Declared once; the page checks against it. */
|
|
15
16
|
export type AppCommands = {
|
|
@@ -30,6 +31,24 @@ export type App = JanelaApp<AppCommands, AppEvents>;
|
|
|
30
31
|
// name must be one of the declared ones, `args` is inferred from it, and the
|
|
31
32
|
// return value has to match.
|
|
32
33
|
export function setup(app: App): void {
|
|
34
|
+
// A menu bar. Items carry their own handlers — there are no ids to declare
|
|
35
|
+
// or match — and `predefined` is the platform's own behaviour, callable like
|
|
36
|
+
// any other function.
|
|
37
|
+
//
|
|
38
|
+
// On macOS the standard submenus (App, Edit, View, Window) are kept around
|
|
39
|
+
// whatever you declare here, so this adds File without costing the app ⌘Q or
|
|
40
|
+
// ⌘V. Windows and Linux need no such floor: their editing keys belong to the
|
|
41
|
+
// webview, and Alt+F4 to the window manager.
|
|
42
|
+
app.setMenu([
|
|
43
|
+
submenu("File", [
|
|
44
|
+
menuItem("Say hello", "CmdOrCtrl+G", () => {
|
|
45
|
+
console.log("[host] hello from the menu");
|
|
46
|
+
}),
|
|
47
|
+
menuSeparator(),
|
|
48
|
+
menuItem("Close", "CmdOrCtrl+W", () => predefined.close()),
|
|
49
|
+
]),
|
|
50
|
+
]);
|
|
51
|
+
|
|
33
52
|
app.command("greet", (args) => {
|
|
34
53
|
return "Hello, " + args.name + "! You've been greeted from a native TypeScript binary.";
|
|
35
54
|
});
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/// <reference types="vite/client" />
|
|
2
|
+
//
|
|
3
|
+
// Declares the modules Vite lets you import that TypeScript otherwise knows
|
|
4
|
+
// nothing about — `./styles.css` most immediately, plus `import.meta.env` and
|
|
5
|
+
// asset imports. Without it a side-effect CSS import is an error in any editor
|
|
6
|
+
// running `noUncheckedSideEffectImports` (TypeScript 5.6+), which is exactly
|
|
7
|
+
// what a red squiggle on line 1 of main.ts turns out to be.
|
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
// returns `null`; every command answers the page's promise with a value.
|
|
11
11
|
|
|
12
12
|
import type { JanelaApp } from "janela/host";
|
|
13
|
+
import { menuItem, menuSeparator, submenu, predefined } from "janela/host";
|
|
13
14
|
|
|
14
15
|
/** Every command this app answers. Declared once; the page checks against it. */
|
|
15
16
|
export type AppCommands = {
|
|
@@ -30,6 +31,24 @@ export type App = JanelaApp<AppCommands, AppEvents>;
|
|
|
30
31
|
// name must be one of the declared ones, `args` is inferred from it, and the
|
|
31
32
|
// return value has to match.
|
|
32
33
|
export function setup(app: App): void {
|
|
34
|
+
// A menu bar. Items carry their own handlers — there are no ids to declare
|
|
35
|
+
// or match — and `predefined` is the platform's own behaviour, callable like
|
|
36
|
+
// any other function.
|
|
37
|
+
//
|
|
38
|
+
// On macOS the standard submenus (App, Edit, View, Window) are kept around
|
|
39
|
+
// whatever you declare here, so this adds File without costing the app ⌘Q or
|
|
40
|
+
// ⌘V. Windows and Linux need no such floor: their editing keys belong to the
|
|
41
|
+
// webview, and Alt+F4 to the window manager.
|
|
42
|
+
app.setMenu([
|
|
43
|
+
submenu("File", [
|
|
44
|
+
menuItem("Say hello", "CmdOrCtrl+G", () => {
|
|
45
|
+
console.log("[host] hello from the menu");
|
|
46
|
+
}),
|
|
47
|
+
menuSeparator(),
|
|
48
|
+
menuItem("Close", "CmdOrCtrl+W", () => predefined.close()),
|
|
49
|
+
]),
|
|
50
|
+
]);
|
|
51
|
+
|
|
33
52
|
app.command("greet", (args) => {
|
|
34
53
|
return "Hello, " + args.name + "! You've been greeted from a native TypeScript binary.";
|
|
35
54
|
});
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/// <reference types="vite/client" />
|
|
2
|
+
//
|
|
3
|
+
// Declares the modules Vite lets you import that TypeScript otherwise knows
|
|
4
|
+
// nothing about — `./styles.css` most immediately, plus `import.meta.env` and
|
|
5
|
+
// asset imports. Without it a side-effect CSS import is an error in any editor
|
|
6
|
+
// running `noUncheckedSideEffectImports` (TypeScript 5.6+), which is exactly
|
|
7
|
+
// what a red squiggle on line 1 of main.ts turns out to be.
|
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
// returns `null`; every command answers the page's promise with a value.
|
|
11
11
|
|
|
12
12
|
import type { JanelaApp } from "janela/host";
|
|
13
|
+
import { menuItem, menuSeparator, submenu, predefined } from "janela/host";
|
|
13
14
|
|
|
14
15
|
/** Every command this app answers. Declared once; the page checks against it. */
|
|
15
16
|
export type AppCommands = {
|
|
@@ -30,6 +31,24 @@ export type App = JanelaApp<AppCommands, AppEvents>;
|
|
|
30
31
|
// name must be one of the declared ones, `args` is inferred from it, and the
|
|
31
32
|
// return value has to match.
|
|
32
33
|
export function setup(app: App): void {
|
|
34
|
+
// A menu bar. Items carry their own handlers — there are no ids to declare
|
|
35
|
+
// or match — and `predefined` is the platform's own behaviour, callable like
|
|
36
|
+
// any other function.
|
|
37
|
+
//
|
|
38
|
+
// On macOS the standard submenus (App, Edit, View, Window) are kept around
|
|
39
|
+
// whatever you declare here, so this adds File without costing the app ⌘Q or
|
|
40
|
+
// ⌘V. Windows and Linux need no such floor: their editing keys belong to the
|
|
41
|
+
// webview, and Alt+F4 to the window manager.
|
|
42
|
+
app.setMenu([
|
|
43
|
+
submenu("File", [
|
|
44
|
+
menuItem("Say hello", "CmdOrCtrl+G", () => {
|
|
45
|
+
console.log("[host] hello from the menu");
|
|
46
|
+
}),
|
|
47
|
+
menuSeparator(),
|
|
48
|
+
menuItem("Close", "CmdOrCtrl+W", () => predefined.close()),
|
|
49
|
+
]),
|
|
50
|
+
]);
|
|
51
|
+
|
|
33
52
|
app.command("greet", (args) => {
|
|
34
53
|
return "Hello, " + args.name + "! You've been greeted from a native TypeScript binary.";
|
|
35
54
|
});
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/// <reference types="vite/client" />
|
|
2
|
+
//
|
|
3
|
+
// Declares the modules Vite lets you import that TypeScript otherwise knows
|
|
4
|
+
// nothing about — `./styles.css` most immediately, plus `import.meta.env` and
|
|
5
|
+
// asset imports. Without it a side-effect CSS import is an error in any editor
|
|
6
|
+
// running `noUncheckedSideEffectImports` (TypeScript 5.6+), which is exactly
|
|
7
|
+
// what a red squiggle on line 1 of main.ts turns out to be.
|
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
// returns `null`; every command answers the page's promise with a value.
|
|
11
11
|
|
|
12
12
|
import type { JanelaApp } from "janela/host";
|
|
13
|
+
import { menuItem, menuSeparator, submenu, predefined } from "janela/host";
|
|
13
14
|
|
|
14
15
|
/** Every command this app answers. Declared once; the page checks against it. */
|
|
15
16
|
export type AppCommands = {
|
|
@@ -30,6 +31,24 @@ export type App = JanelaApp<AppCommands, AppEvents>;
|
|
|
30
31
|
// name must be one of the declared ones, `args` is inferred from it, and the
|
|
31
32
|
// return value has to match.
|
|
32
33
|
export function setup(app: App): void {
|
|
34
|
+
// A menu bar. Items carry their own handlers — there are no ids to declare
|
|
35
|
+
// or match — and `predefined` is the platform's own behaviour, callable like
|
|
36
|
+
// any other function.
|
|
37
|
+
//
|
|
38
|
+
// On macOS the standard submenus (App, Edit, View, Window) are kept around
|
|
39
|
+
// whatever you declare here, so this adds File without costing the app ⌘Q or
|
|
40
|
+
// ⌘V. Windows and Linux need no such floor: their editing keys belong to the
|
|
41
|
+
// webview, and Alt+F4 to the window manager.
|
|
42
|
+
app.setMenu([
|
|
43
|
+
submenu("File", [
|
|
44
|
+
menuItem("Say hello", "CmdOrCtrl+G", () => {
|
|
45
|
+
console.log("[host] hello from the menu");
|
|
46
|
+
}),
|
|
47
|
+
menuSeparator(),
|
|
48
|
+
menuItem("Close", "CmdOrCtrl+W", () => predefined.close()),
|
|
49
|
+
]),
|
|
50
|
+
]);
|
|
51
|
+
|
|
33
52
|
app.command("greet", (args) => {
|
|
34
53
|
return "Hello, " + args.name + "! You've been greeted from a native TypeScript binary.";
|
|
35
54
|
});
|