plusui-native 0.2.108 → 0.2.109

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.
@@ -1,36 +1,36 @@
1
- import { defineConfig } from 'vite';
2
- import solid from 'vite-plugin-solid';
3
- import { resolve, dirname } from 'path';
4
- import { fileURLToPath } from 'url';
5
- import { existsSync } from 'fs';
6
-
7
- const __filename = fileURLToPath(import.meta.url);
8
- const __dirname = dirname(__filename);
9
-
10
- function findPlusuiEntry(): string {
11
- const candidates = [
12
- resolve(__dirname, '../../Core/Features/API/index.ts'),
13
- resolve(__dirname, '../node_modules/plusui-native-core/Core/Features/API/index.ts'),
14
- ];
15
- for (const p of candidates) {
16
- if (existsSync(p)) return p;
17
- }
18
- return 'plusui-native-core';
19
- }
20
-
21
- export default defineConfig({
22
- plugins: [solid()],
23
- resolve: {
24
- alias: {
25
- plusui: findPlusuiEntry(),
26
- },
27
- },
28
- build: {
29
- outDir: 'dist',
30
- emptyOutDir: true,
31
- },
32
- server: {
33
- port: 5173,
34
- strictPort: false,
35
- },
36
- });
1
+ import { defineConfig } from 'vite';
2
+ import solid from 'vite-plugin-solid';
3
+ import { resolve, dirname } from 'path';
4
+ import { fileURLToPath } from 'url';
5
+ import { existsSync } from 'fs';
6
+
7
+ const __filename = fileURLToPath(import.meta.url);
8
+ const __dirname = dirname(__filename);
9
+
10
+ function findPlusuiEntry(): string {
11
+ const candidates = [
12
+ resolve(__dirname, '../../Core/Features/API/index.ts'),
13
+ resolve(__dirname, '../node_modules/plusui-native-core/Core/Features/API/index.ts'),
14
+ ];
15
+ for (const p of candidates) {
16
+ if (existsSync(p)) return p;
17
+ }
18
+ return 'plusui-native-core';
19
+ }
20
+
21
+ export default defineConfig({
22
+ plugins: [solid()],
23
+ resolve: {
24
+ alias: {
25
+ plusui: findPlusuiEntry(),
26
+ },
27
+ },
28
+ build: {
29
+ outDir: 'dist',
30
+ emptyOutDir: true,
31
+ },
32
+ server: {
33
+ port: 5173,
34
+ strictPort: false,
35
+ },
36
+ });
@@ -1,109 +1,109 @@
1
- #include <plusui/plusui>
2
- #include <iostream>
3
- #include "generated/assets.h"
4
-
5
- // Include the auto-generated semantic connect bindings.
6
- // Run `plusui connect` to generate this file.
7
- #include "Connections/connections.gen.hpp"
8
-
9
- using namespace plusui;
10
- using json = nlohmann::json;
11
-
12
- // ============================================================================
13
- // {{PROJECT_NAME}} — Configuration
14
- // ============================================================================
15
- // Edit these structs to configure your app.
16
- // Built-in features (window, router, clipboard, etc.) work without any extra
17
- // wiring — just call them from the frontend via `import plusui from 'plusui'`.
18
- //
19
- // Custom frontend ↔ backend communication:
20
- // Use connect::namespace.method syntax anywhere, then run `plusui connect`.
21
- // ============================================================================
22
-
23
- struct AppConfig {
24
- std::string name = "{{PROJECT_NAME}}";
25
- std::string version = "0.1.0";
26
- } appConfig;
27
-
28
- struct WindowConfig {
29
- int width = 1200;
30
- int height = 800;
31
- bool resizable = true;
32
- bool showTitlebar = true;
33
- bool transparent = false;
34
- double opacity = 1.0;
35
- bool alwaysOnTop = false;
36
- bool showInTaskbar = true;
37
- bool devTools = true;
38
- bool scrollbars = false;
39
- bool fileDrop = true; // Enable file drop from OS to webview
40
- bool tray = true; // Enable system tray
41
- std::string route = "/"; // Starting route
42
- int devServerPort = 5173;
43
- } windowConfig;
44
-
45
- // ============================================================================
46
- // CUSTOM COMMUNICATION (optional)
47
- // ============================================================================
48
- // Use connect::namespace.method syntax for CUSTOM frontend ↔ backend
49
- // communication. Built-in features (window, clipboard, app) are accessed
50
- // directly via their APIs.
51
- //
52
- // Example custom patterns (auto-detected by `plusui connect`):
53
- //
54
- // // Handle a call from the frontend (Request/Response):
55
- // connect::user.handleFetch = [](const json& p) -> json {
56
- // return {{"name", "Dannan"}, {"id", p["id"]}};
57
- // };
58
- //
59
- // // Send an event to the frontend (Fire & Forget):
60
- // connect::app.notify({{"msg", "Backend ready!"}});
61
- //
62
- // // Listen for events from the frontend (Event listener):
63
- // connect::system.onMinimize = [](const json&) {
64
- // mainWindow.minimize();
65
- // };
66
- //
67
- // Run `plusui connect` after writing your custom communication code.
68
- // ============================================================================
69
-
70
- int main() {
71
- auto mainWindow = createApp()
72
- .title(appConfig.name)
73
- .width(windowConfig.width)
74
- .height(windowConfig.height)
75
- .resizable(windowConfig.resizable)
76
- .decorations(windowConfig.showTitlebar)
77
- .transparent(windowConfig.transparent)
78
- .devtools(windowConfig.devTools)
79
- .alwaysOnTop(windowConfig.alwaysOnTop)
80
- .skipTaskbar(!windowConfig.showInTaskbar)
81
- .scrollbars(windowConfig.scrollbars)
82
- .fileDrop(windowConfig.fileDrop)
83
- .tray(windowConfig.tray)
84
- .centered(true)
85
- .build();
86
-
87
- // Icon from embedded assets
88
- #ifdef ASSET_ICON_PNG
89
- mainWindow.setIconFromMemory(ASSET_ICON_PNG, ASSET_ICON_PNG_LEN);
90
- mainWindow.setTrayIconFromMemory(ASSET_ICON_PNG, ASSET_ICON_PNG_LEN);
91
- #endif
92
-
93
- // Wire up connect system (for custom frontend ↔ backend communication)
94
- // Run `plusui connect` after adding custom connect methods
95
- static Connect conn;
96
- bindConnect(mainWindow, conn);
97
-
98
- // Load frontend then show.
99
- #ifdef PLUSUI_DEV_MODE
100
- mainWindow.navigate("http://localhost:" + std::to_string(windowConfig.devServerPort) + windowConfig.route);
101
- #else
102
- mainWindow.loadFile("frontend/dist/index.html" + (windowConfig.route == "/" ? "" : "#" + windowConfig.route));
103
- #endif
104
- mainWindow.show();
105
-
106
- App runtime;
107
- runtime.run();
108
- return 0;
109
- }
1
+ #include <plusui/plusui>
2
+ #include <iostream>
3
+ #include "generated/assets.h"
4
+
5
+ // Include the auto-generated semantic connect bindings.
6
+ // Run `plusui connect` to generate this file.
7
+ #include "Connections/connections.gen.hpp"
8
+
9
+ using namespace plusui;
10
+ using json = nlohmann::json;
11
+
12
+ // ============================================================================
13
+ // {{PROJECT_NAME}} — Configuration
14
+ // ============================================================================
15
+ // Edit these structs to configure your app.
16
+ // Built-in features (window, router, clipboard, etc.) work without any extra
17
+ // wiring — just call them from the frontend via `import plusui from 'plusui'`.
18
+ //
19
+ // Custom frontend ↔ backend communication:
20
+ // Use connect::namespace.method syntax anywhere, then run `plusui connect`.
21
+ // ============================================================================
22
+
23
+ struct AppConfig {
24
+ std::string name = "{{PROJECT_NAME}}";
25
+ std::string version = "0.1.0";
26
+ } appConfig;
27
+
28
+ struct WindowConfig {
29
+ int width = 1200;
30
+ int height = 800;
31
+ bool resizable = true;
32
+ bool showTitlebar = true;
33
+ bool transparent = false;
34
+ double opacity = 1.0;
35
+ bool alwaysOnTop = false;
36
+ bool showInTaskbar = true;
37
+ bool devTools = true;
38
+ bool scrollbars = false;
39
+ bool fileDrop = true; // Enable file drop from OS to webview
40
+ bool tray = true; // Enable system tray
41
+ std::string route = "/"; // Starting route
42
+ int devServerPort = 5173;
43
+ } windowConfig;
44
+
45
+ // ============================================================================
46
+ // CUSTOM COMMUNICATION (optional)
47
+ // ============================================================================
48
+ // Use connect::namespace.method syntax for CUSTOM frontend ↔ backend
49
+ // communication. Built-in features (window, clipboard, app) are accessed
50
+ // directly via their APIs.
51
+ //
52
+ // Example custom patterns (auto-detected by `plusui connect`):
53
+ //
54
+ // // Handle a call from the frontend (Request/Response):
55
+ // connect::user.handleFetch = [](const json& p) -> json {
56
+ // return {{"name", "Dannan"}, {"id", p["id"]}};
57
+ // };
58
+ //
59
+ // // Send an event to the frontend (Fire & Forget):
60
+ // connect::app.notify({{"msg", "Backend ready!"}});
61
+ //
62
+ // // Listen for events from the frontend (Event listener):
63
+ // connect::system.onMinimize = [](const json&) {
64
+ // mainWindow.minimize();
65
+ // };
66
+ //
67
+ // Run `plusui connect` after writing your custom communication code.
68
+ // ============================================================================
69
+
70
+ int main() {
71
+ auto mainWindow = createApp()
72
+ .title(appConfig.name)
73
+ .width(windowConfig.width)
74
+ .height(windowConfig.height)
75
+ .resizable(windowConfig.resizable)
76
+ .decorations(windowConfig.showTitlebar)
77
+ .transparent(windowConfig.transparent)
78
+ .devtools(windowConfig.devTools)
79
+ .alwaysOnTop(windowConfig.alwaysOnTop)
80
+ .skipTaskbar(!windowConfig.showInTaskbar)
81
+ .scrollbars(windowConfig.scrollbars)
82
+ .fileDrop(windowConfig.fileDrop)
83
+ .tray(windowConfig.tray)
84
+ .centered(true)
85
+ .build();
86
+
87
+ // Icon from embedded assets
88
+ #ifdef ASSET_ICON_PNG
89
+ mainWindow.setIconFromMemory(ASSET_ICON_PNG, ASSET_ICON_PNG_LEN);
90
+ mainWindow.setTrayIconFromMemory(ASSET_ICON_PNG, ASSET_ICON_PNG_LEN);
91
+ #endif
92
+
93
+ // Wire up connect system (for custom frontend ↔ backend communication)
94
+ // Run `plusui connect` after adding custom connect methods
95
+ static Connect conn;
96
+ bindConnect(mainWindow, conn);
97
+
98
+ // Load frontend then show.
99
+ #ifdef PLUSUI_DEV_MODE
100
+ mainWindow.navigate("http://localhost:" + std::to_string(windowConfig.devServerPort) + windowConfig.route);
101
+ #else
102
+ mainWindow.loadFile("frontend/dist/index.html" + (windowConfig.route == "/" ? "" : "#" + windowConfig.route));
103
+ #endif
104
+ mainWindow.show();
105
+
106
+ App runtime;
107
+ runtime.run();
108
+ return 0;
109
+ }