@niyamulahsan/create-deskapp 1.2.4 → 1.2.6
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/package.json +16 -16
- package/template/.env.example +20 -13
- package/template/AGENTS.md +699 -0
- package/template/package.json +3 -0
- package/template/src/config/app.ts +26 -24
- package/template/src/config/winsetup.ts +93 -91
- package/template/src/core/api/binding-error.ts +57 -0
- package/template/src/core/api/bindings.generated.ts +2 -0
- package/template/src/core/api/generate.manifest.ts +84 -80
- package/template/src/core/api/registry.ts +58 -48
- package/template/src/core/config.ts +101 -99
- package/template/src/core/database/aggregate.ts +89 -85
- package/template/src/core/database/config.ts +50 -48
- package/template/src/core/database/connection.ts +116 -114
- package/template/src/core/database/migrate-hooks.ts +86 -84
- package/template/src/core/database/paginate.ts +226 -224
- package/template/src/core/database/reset.ts +21 -19
- package/template/src/core/database/seed.ts +169 -167
- package/template/src/core/database/status.ts +37 -35
- package/template/src/core/env.ts +108 -106
- package/template/src/core/facade.ts +63 -61
- package/template/src/core/maker/db/fresh.ts +10 -8
- package/template/src/core/maker/db/generate.ts +13 -11
- package/template/src/core/maker/db/helpers.ts +92 -96
- package/template/src/core/maker/db/migrate.ts +37 -35
- package/template/src/core/maker/db/mod.ts +93 -91
- package/template/src/core/maker/db/module-migrate.ts +56 -54
- package/template/src/core/maker/db/push.ts +23 -21
- package/template/src/core/maker/db/reset.ts +8 -6
- package/template/src/core/maker/db/seed.ts +9 -7
- package/template/src/core/maker/db/status.ts +8 -6
- package/template/src/core/maker/help.ts +59 -57
- package/template/src/core/maker/make/controller.ts +25 -22
- package/template/src/core/maker/make/helpers.ts +97 -91
- package/template/src/core/maker/make/mod.ts +69 -67
- package/template/src/core/maker/make/model.ts +16 -14
- package/template/src/core/maker/make/module.ts +53 -39
- package/template/src/core/maker/make/seeder.ts +23 -21
- package/template/src/core/maker/make/test.ts +33 -30
- package/template/src/core/maker/mod.ts +85 -83
- package/template/src/core/maker/run/mod.ts +134 -132
- package/template/src/core/maker/stub.ts +26 -24
- package/template/src/core/maker/stubs/controller/controller.controller.stub +57 -55
- package/template/src/core/maker/stubs/controller/controller.schema.stub +18 -13
- package/template/src/core/maker/stubs/facade/facade.stub +21 -0
- package/template/src/core/maker/stubs/model/model.stub +10 -8
- package/template/src/core/maker/stubs/seeder/seeder.stub +18 -16
- package/template/src/core/maker/stubs/test/test.stub +9 -7
- package/template/src/core/maker/sync-config.ts +93 -94
- package/template/src/core/utils/password.ts +29 -27
- package/template/src/core/utils/playwright.ts +123 -121
- package/template/src/core/utils/queue.ts +68 -66
- package/template/src/core/utils/scheduler.ts +62 -60
- package/template/src/core/utils/storage.ts +3 -1
- package/template/src/core/utils/validation.ts +37 -35
- package/template/src/database/schema.ts +2 -0
- package/template/src/main.ts +120 -118
- package/template/src/modules/app/__tests__/demo.controller.test.ts +75 -0
- package/template/src/modules/app/__tests__/net.controller.test.ts +65 -0
- package/template/src/modules/app/__tests__/playwright.controller.test.ts +50 -0
- package/template/src/modules/app/__tests__/storage.controller.test.ts +114 -0
- package/template/src/modules/app/__tests__/window.controller.test.ts +98 -0
- package/template/src/modules/app/controllers/demo.controller.ts +120 -118
- package/template/src/modules/app/controllers/net.controller.ts +50 -48
- package/template/src/modules/app/controllers/playwright.controller.ts +142 -140
- package/template/src/modules/app/controllers/storage.controller.ts +231 -229
- package/template/src/modules/app/controllers/window.controller.ts +2 -0
- package/template/src/modules/app/facade.ts +21 -0
- package/template/src/preload.ts +25 -2
- package/template/src/ui/src/App.vue +4 -2
- package/template/src/ui/src/app.ts +38 -23
- package/template/src/ui/src/bindings.d.ts +18 -16
- package/template/src/ui/src/components/Button.vue +34 -32
- package/template/src/ui/src/components/Checkbox.vue +26 -29
- package/template/src/ui/src/components/Input.vue +221 -227
- package/template/src/ui/src/components/InputGroup.vue +141 -0
- package/template/src/ui/src/components/InputPasswordToggle.vue +204 -0
- package/template/src/ui/src/components/Modal.vue +65 -55
- package/template/src/ui/src/components/Spinner.vue +44 -42
- package/template/src/ui/src/components/Switch.vue +62 -65
- package/template/src/ui/src/components/TextArea.vue +108 -121
- package/template/src/ui/src/components/Toast.vue +55 -56
- package/template/src/ui/src/components/datatable/DataTableSkeleton.vue +100 -98
- package/template/src/ui/src/components/datatable/Pagination.vue +153 -125
- package/template/src/ui/src/components/datatable/SelectOpption.vue +36 -35
- package/template/src/ui/src/components/datatable/index.vue +336 -258
- package/template/src/ui/src/env.d.ts +16 -13
- package/template/src/ui/src/global.d.ts +21 -2
- package/template/src/ui/src/helpers/nformatter.ts +12 -10
- package/template/src/ui/src/pages/dashboard/index.vue +690 -687
- package/template/src/ui/src/plugins/browserDetect.ts +57 -0
- package/template/src/ui/src/plugins/gum.ts +576 -549
- package/template/src/ui/src/plugins/pulse.ts +181 -147
- package/template/src/ui/src/plugins/routeProgress.ts +89 -0
- package/template/src/ui/src/router/index.ts +44 -25
- package/template/src/ui/src/stores/example.ts +2 -0
- package/template/src/ui/vite.config.ts +40 -38
- package/template/src/window/app-menu.ts +89 -87
- package/template/src/window/config.ts +14 -12
- package/template/src/window/context-menu.ts +23 -21
- package/template/src/window/dialogs.ts +92 -90
- package/template/src/window/manager.ts +2 -0
- package/template/src/window/native.ts +47 -45
- package/template/src/window/tray.ts +132 -130
|
@@ -1,87 +1,89 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
if (
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
"
|
|
62
|
-
{
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
"
|
|
73
|
-
{ role: { role: "
|
|
74
|
-
|
|
75
|
-
{ role: { role: "
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
Menu.
|
|
87
|
-
|
|
1
|
+
// ./src/window/app-menu.ts
|
|
2
|
+
|
|
3
|
+
import { Menu } from "electron";
|
|
4
|
+
import { type DesktopWindow, win as winApi } from "@/window/manager";
|
|
5
|
+
|
|
6
|
+
export function removeAppMenu(win: DesktopWindow): void {
|
|
7
|
+
win.setMenu(null);
|
|
8
|
+
// On Windows/Linux this controls the application menu bar.
|
|
9
|
+
Menu.setApplicationMenu(null);
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export interface MenuRole {
|
|
13
|
+
role: string;
|
|
14
|
+
}
|
|
15
|
+
export interface MenuActionItem {
|
|
16
|
+
item: { label: string; id?: string; accelerator?: string; enabled?: boolean };
|
|
17
|
+
}
|
|
18
|
+
export interface MenuSubmenu {
|
|
19
|
+
submenu: { label: string; items: MenuItem[] };
|
|
20
|
+
}
|
|
21
|
+
export type MenuItem = MenuActionItem | MenuSubmenu | "separator" | { role: MenuRole };
|
|
22
|
+
|
|
23
|
+
// Map our custom MenuItem types to Electron's MenuItemConstructorOptions
|
|
24
|
+
export function toElectronMenu(items: MenuItem[]): Electron.MenuItemConstructorOptions[] {
|
|
25
|
+
return items.map((item) => {
|
|
26
|
+
if (item === "separator") return { type: "separator" };
|
|
27
|
+
if ("role" in item) return { role: item.role.role as any };
|
|
28
|
+
if ("item" in item) {
|
|
29
|
+
return {
|
|
30
|
+
label: item.item.label,
|
|
31
|
+
id: item.item.id,
|
|
32
|
+
accelerator: item.item.accelerator,
|
|
33
|
+
enabled: item.item.enabled,
|
|
34
|
+
click: () => {
|
|
35
|
+
// Forward clicks to the window's custom event if needed,
|
|
36
|
+
// or handle globally
|
|
37
|
+
const mainWin = winApi.getWindow();
|
|
38
|
+
if (mainWin && item.item.id) {
|
|
39
|
+
// Emulate Deno's event by executing custom JS or sending IPC
|
|
40
|
+
mainWin.webContents.send("menu-click", item.item.id);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
if ("submenu" in item) {
|
|
46
|
+
return {
|
|
47
|
+
label: item.submenu.label,
|
|
48
|
+
submenu: toElectronMenu(item.submenu.items)
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
return {};
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export function defaultMenuItems(): MenuItem[] {
|
|
56
|
+
return [
|
|
57
|
+
{
|
|
58
|
+
submenu: {
|
|
59
|
+
label: "File",
|
|
60
|
+
items: [
|
|
61
|
+
{ item: { label: "New", id: "new", accelerator: "CmdOrCtrl+N", enabled: true } },
|
|
62
|
+
{ item: { label: "Open Settings", id: "openSettings", accelerator: "CmdOrCtrl+,", enabled: true } },
|
|
63
|
+
"separator",
|
|
64
|
+
{ role: { role: "quit" } }
|
|
65
|
+
]
|
|
66
|
+
}
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
submenu: {
|
|
70
|
+
label: "Edit",
|
|
71
|
+
items: [
|
|
72
|
+
{ role: { role: "undo" } },
|
|
73
|
+
{ role: { role: "redo" } },
|
|
74
|
+
"separator",
|
|
75
|
+
{ role: { role: "cut" } },
|
|
76
|
+
{ role: { role: "copy" } },
|
|
77
|
+
{ role: { role: "paste" } }
|
|
78
|
+
]
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
];
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
export function installAppMenu(win: DesktopWindow): void {
|
|
85
|
+
// Set menu for the main window (also sets application menu on Windows/Linux).
|
|
86
|
+
const menu = Menu.buildFromTemplate(toElectronMenu(defaultMenuItems()));
|
|
87
|
+
win.setMenu(menu);
|
|
88
|
+
Menu.setApplicationMenu(menu);
|
|
89
|
+
}
|
|
@@ -1,12 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
export
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
type
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
1
|
+
// ./src/window/config.ts
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Backward-compat re-export. Window base setup lives in src/config/winsetup.ts.
|
|
5
|
+
*/
|
|
6
|
+
export {
|
|
7
|
+
type ChromeParts,
|
|
8
|
+
type DevToolsMode,
|
|
9
|
+
resolveChrome,
|
|
10
|
+
type WindowPreset,
|
|
11
|
+
windowConfig,
|
|
12
|
+
windowDev,
|
|
13
|
+
windows
|
|
14
|
+
} from "@config/winsetup";
|
|
@@ -1,21 +1,23 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
{
|
|
10
|
-
{
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
1
|
+
// ./src/window/context-menu.ts
|
|
2
|
+
|
|
3
|
+
import { Menu } from "electron";
|
|
4
|
+
import type { DesktopWindow } from "@/window/manager";
|
|
5
|
+
|
|
6
|
+
export function installContextMenu(win: DesktopWindow): void {
|
|
7
|
+
win.webContents.on("context-menu", (_event, _params) => {
|
|
8
|
+
const menu = Menu.buildFromTemplate([
|
|
9
|
+
{ role: "copy" },
|
|
10
|
+
{ role: "paste" },
|
|
11
|
+
{ type: "separator" },
|
|
12
|
+
{ label: "Reload", click: () => win.reload() }
|
|
13
|
+
]);
|
|
14
|
+
menu.popup({ window: win });
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export function disableContextMenu(win: DesktopWindow): void {
|
|
19
|
+
// Suppress default/custom context menu when explicitly disabled.
|
|
20
|
+
win.webContents.on("context-menu", (event) => {
|
|
21
|
+
event.preventDefault();
|
|
22
|
+
});
|
|
23
|
+
}
|
|
@@ -1,90 +1,92 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
// ---------------------------------------------------------------------------
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
1
|
+
// ./src/window/dialogs.ts
|
|
2
|
+
|
|
3
|
+
import { BrowserWindow, dialog } from "electron";
|
|
4
|
+
|
|
5
|
+
// ---------------------------------------------------------------------------
|
|
6
|
+
// Message dialogs (confirm / alert / prompt)
|
|
7
|
+
// ---------------------------------------------------------------------------
|
|
8
|
+
|
|
9
|
+
export async function confirmDialog(message: string): Promise<boolean> {
|
|
10
|
+
const result = await dialog.showMessageBox({
|
|
11
|
+
type: "question",
|
|
12
|
+
buttons: ["Cancel", "OK"],
|
|
13
|
+
title: "Confirm",
|
|
14
|
+
message: message
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
return result.response === 1;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export async function alertDialog(message: string): Promise<void> {
|
|
21
|
+
await dialog.showMessageBox({
|
|
22
|
+
type: "info",
|
|
23
|
+
title: "Alert",
|
|
24
|
+
message: message
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export interface PickOpenOptions {
|
|
29
|
+
title?: string;
|
|
30
|
+
filter?: string; // Electron uses extensions array, but we can parse your string
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export interface PickSaveOptions {
|
|
34
|
+
title?: string;
|
|
35
|
+
defaultName?: string;
|
|
36
|
+
filter?: string;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export interface PickFolderOptions {
|
|
40
|
+
title?: string;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
// Helper to convert "All files (*.*)|*.*" to Electron format: [{ name: 'All files', extensions: ['*'] }]
|
|
44
|
+
export function parseFilter(filterStr?: string) {
|
|
45
|
+
if (!filterStr) return undefined;
|
|
46
|
+
const parts = filterStr.split("|");
|
|
47
|
+
const filters = [];
|
|
48
|
+
for (let i = 0; i < parts.length; i += 2) {
|
|
49
|
+
if (parts[i] && parts[i + 1]) {
|
|
50
|
+
filters.push({
|
|
51
|
+
name: parts[i].replace(/\s*\(.*?\)\s*/, ""),
|
|
52
|
+
extensions: parts[i + 1].split(";").map((ext) => ext.replace("*.", "").replace("*", "*"))
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
return filters.length > 0 ? filters : undefined;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
async function pickOpenPath(options: PickOpenOptions = {}): Promise<string | null> {
|
|
60
|
+
const win = BrowserWindow.getFocusedWindow();
|
|
61
|
+
const result = await dialog.showOpenDialog(win!, {
|
|
62
|
+
title: options.title ?? "Open a file",
|
|
63
|
+
properties: ["openFile"],
|
|
64
|
+
filters: parseFilter(options.filter)
|
|
65
|
+
});
|
|
66
|
+
return result.canceled ? null : result.filePaths[0];
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
async function pickSavePath(options: PickSaveOptions = {}): Promise<string | null> {
|
|
70
|
+
const win = BrowserWindow.getFocusedWindow();
|
|
71
|
+
const result = await dialog.showSaveDialog(win!, {
|
|
72
|
+
title: options.title ?? "Save as",
|
|
73
|
+
defaultPath: options.defaultName,
|
|
74
|
+
filters: parseFilter(options.filter)
|
|
75
|
+
});
|
|
76
|
+
return result.canceled ? null : result.filePath || null;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
async function pickFolder(options: PickFolderOptions = {}): Promise<string | null> {
|
|
80
|
+
const win = BrowserWindow.getFocusedWindow();
|
|
81
|
+
const result = await dialog.showOpenDialog(win!, {
|
|
82
|
+
title: options.title ?? "Choose a folder",
|
|
83
|
+
properties: ["openDirectory"]
|
|
84
|
+
});
|
|
85
|
+
return result.canceled ? null : result.filePaths[0];
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
export const pickers = {
|
|
89
|
+
open: pickOpenPath,
|
|
90
|
+
save: pickSavePath,
|
|
91
|
+
folder: pickFolder
|
|
92
|
+
};
|
|
@@ -1,45 +1,47 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import
|
|
7
|
-
import {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
export type {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
if (parts.
|
|
24
|
-
else
|
|
25
|
-
if (parts.
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
1
|
+
// ./src/window/native.ts
|
|
2
|
+
|
|
3
|
+
import type { ChromeParts } from "@config/winsetup";
|
|
4
|
+
import { resolveChrome } from "@config/winsetup";
|
|
5
|
+
import { defaultMenuItems, installAppMenu, removeAppMenu } from "./app-menu";
|
|
6
|
+
import { disableContextMenu, installContextMenu } from "./context-menu";
|
|
7
|
+
import { alertDialog, confirmDialog } from "./dialogs";
|
|
8
|
+
import type { DesktopWindow } from "./manager";
|
|
9
|
+
import { createAppTray, createHeadlessTray, createTray, hideDock, isTrayAvailable } from "./tray";
|
|
10
|
+
|
|
11
|
+
export type { MenuActionItem, MenuItem, MenuRole, MenuSubmenu } from "@/window/app-menu";
|
|
12
|
+
export type { DesktopTray } from "@/window/tray";
|
|
13
|
+
export type { ChromeParts };
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Install desktop chrome for a window. Pass `parts` for granular control;
|
|
17
|
+
* defaults to all enabled (backward compatible).
|
|
18
|
+
*/
|
|
19
|
+
function setupDesktopChrome(
|
|
20
|
+
win: DesktopWindow,
|
|
21
|
+
parts: Required<ChromeParts> = { appMenu: true, contextMenu: true, tray: true },
|
|
22
|
+
): void {
|
|
23
|
+
if (parts.appMenu) installAppMenu(win);
|
|
24
|
+
else removeAppMenu(win);
|
|
25
|
+
if (parts.contextMenu) installContextMenu(win);
|
|
26
|
+
else disableContextMenu(win);
|
|
27
|
+
if (parts.tray) createAppTray();
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export const chrome = {
|
|
31
|
+
// Tray
|
|
32
|
+
createTray,
|
|
33
|
+
isTrayAvailable,
|
|
34
|
+
createAppTray,
|
|
35
|
+
createHeadlessTray,
|
|
36
|
+
hideDock,
|
|
37
|
+
// Dialogs
|
|
38
|
+
confirmDialog,
|
|
39
|
+
alertDialog,
|
|
40
|
+
// Menu
|
|
41
|
+
defaultMenuItems,
|
|
42
|
+
installAppMenu,
|
|
43
|
+
installContextMenu,
|
|
44
|
+
// Orchestration
|
|
45
|
+
setupDesktopChrome,
|
|
46
|
+
resolveChrome
|
|
47
|
+
};
|