plusui-native 0.2.106 → 0.2.108
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 +4 -4
- package/src/assets/icon-generator.js +251 -251
- package/src/assets/resource-embedder.js +351 -351
- package/src/index.js +1358 -1354
- package/templates/base/assets/README.md +88 -88
- package/templates/manager.js +288 -275
- package/templates/react/CMakeLists.txt.template +18 -15
- package/templates/react/frontend/vite.config.ts +1 -1
- package/templates/react/main.cpp.template +5 -7
- package/templates/solid/CMakeLists.txt.template +18 -15
- package/templates/solid/frontend/vite.config.ts +1 -1
- package/templates/solid/main.cpp.template +5 -7
|
@@ -5,12 +5,15 @@ if(POLICY CMP0141)
|
|
|
5
5
|
cmake_policy(SET CMP0141 NEW)
|
|
6
6
|
endif()
|
|
7
7
|
|
|
8
|
-
project({{
|
|
8
|
+
project({{PROJECT_NAME_LOWER}} VERSION {{PROJECT_VERSION}} LANGUAGES CXX)
|
|
9
9
|
|
|
10
10
|
set(CMAKE_CXX_STANDARD 20)
|
|
11
11
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
|
12
12
|
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
|
13
13
|
|
|
14
|
+
# Convert PROJECT_NAME to lowercase for executables
|
|
15
|
+
string(TOLOWER "{{PROJECT_NAME_LOWER}}" PROJECT_NAME_LOWER)
|
|
16
|
+
|
|
14
17
|
# Platform detection
|
|
15
18
|
if(WIN32)
|
|
16
19
|
add_definitions(-DPLUSUI_EDGE)
|
|
@@ -120,15 +123,15 @@ if(NOT EXISTS "${PLUSUI_CORE_DIR}/Features/FileDrop/filedrop.cpp")
|
|
|
120
123
|
endif()
|
|
121
124
|
|
|
122
125
|
# Create the executable
|
|
123
|
-
add_executable({{
|
|
126
|
+
add_executable({{PROJECT_NAME_LOWER}} main.cpp)
|
|
124
127
|
|
|
125
128
|
# Optional: Add your own C++ files here
|
|
126
129
|
# file(GLOB_RECURSE MY_SOURCES "features/*.cpp")
|
|
127
|
-
# target_sources({{
|
|
130
|
+
# target_sources({{PROJECT_NAME_LOWER}} PRIVATE ${MY_SOURCES})
|
|
128
131
|
|
|
129
132
|
# Link PlusUI library
|
|
130
|
-
target_link_libraries({{
|
|
131
|
-
target_include_directories({{
|
|
133
|
+
target_link_libraries({{PROJECT_NAME_LOWER}} PRIVATE plusui)
|
|
134
|
+
target_include_directories({{PROJECT_NAME_LOWER}} PRIVATE ${CMAKE_SOURCE_DIR})
|
|
132
135
|
|
|
133
136
|
# Platform-specific setup
|
|
134
137
|
if(WIN32)
|
|
@@ -147,26 +150,26 @@ if(WIN32)
|
|
|
147
150
|
|
|
148
151
|
if(WEBVIEW2_INCLUDE_DIR)
|
|
149
152
|
message(STATUS "Found WebView2 headers at: ${WEBVIEW2_INCLUDE_DIR}")
|
|
150
|
-
target_include_directories({{
|
|
153
|
+
target_include_directories({{PROJECT_NAME_LOWER}} PRIVATE ${WEBVIEW2_INCLUDE_DIR})
|
|
151
154
|
else()
|
|
152
155
|
message(WARNING "WebView2 headers not found. Building may fail.")
|
|
153
156
|
message(STATUS "Please install WebView2 SDK via NuGet:")
|
|
154
157
|
message(STATUS " nuget install Microsoft.Web.WebView2 -OutputDirectory packages")
|
|
155
158
|
endif()
|
|
156
159
|
|
|
157
|
-
target_link_libraries({{
|
|
160
|
+
target_link_libraries({{PROJECT_NAME_LOWER}} PRIVATE ole32 shell32 shlwapi user32 version)
|
|
158
161
|
# Keep default console subsystem so standard int main() works in all build modes.
|
|
159
162
|
elseif(APPLE)
|
|
160
163
|
# macOS: WebKit
|
|
161
164
|
find_library(WEBKIT_LIBRARY WebKit REQUIRED)
|
|
162
165
|
find_library(COCOA_LIBRARY Cocoa REQUIRED)
|
|
163
|
-
target_link_libraries({{
|
|
166
|
+
target_link_libraries({{PROJECT_NAME_LOWER}} PRIVATE ${WEBKIT_LIBRARY} ${COCOA_LIBRARY})
|
|
164
167
|
|
|
165
168
|
# Create app bundle for production
|
|
166
169
|
if(NOT PLUSUI_DEV_MODE)
|
|
167
|
-
set_target_properties({{
|
|
170
|
+
set_target_properties({{PROJECT_NAME_LOWER}} PROPERTIES
|
|
168
171
|
MACOSX_BUNDLE TRUE
|
|
169
|
-
MACOSX_BUNDLE_BUNDLE_NAME "{{
|
|
172
|
+
MACOSX_BUNDLE_BUNDLE_NAME "{{PROJECT_NAME_LOWER}}"
|
|
170
173
|
MACOSX_BUNDLE_BUNDLE_VERSION "{{PROJECT_VERSION}}"
|
|
171
174
|
MACOSX_BUNDLE_GUI_IDENTIFIER "com.plusui.{{PROJECT_NAME_LOWER}}"
|
|
172
175
|
)
|
|
@@ -176,17 +179,17 @@ else()
|
|
|
176
179
|
find_package(PkgConfig REQUIRED)
|
|
177
180
|
pkg_check_modules(GTK3 REQUIRED gtk+-3.0)
|
|
178
181
|
pkg_check_modules(WEBKIT2 REQUIRED webkit2gtk-4.0)
|
|
179
|
-
target_include_directories({{
|
|
180
|
-
target_link_libraries({{
|
|
182
|
+
target_include_directories({{PROJECT_NAME_LOWER}} PRIVATE ${GTK3_INCLUDE_DIRS} ${WEBKIT2_INCLUDE_DIRS})
|
|
183
|
+
target_link_libraries({{PROJECT_NAME_LOWER}} PRIVATE ${GTK3_LIBRARIES} ${WEBKIT2_LIBRARIES})
|
|
181
184
|
endif()
|
|
182
185
|
|
|
183
186
|
# Copy frontend dist files to build directory after build
|
|
184
187
|
if(EXISTS "${CMAKE_SOURCE_DIR}/frontend/dist")
|
|
185
|
-
add_custom_command(TARGET {{
|
|
186
|
-
COMMAND ${CMAKE_COMMAND} -E make_directory "$<TARGET_FILE_DIR:{{
|
|
188
|
+
add_custom_command(TARGET {{PROJECT_NAME_LOWER}} POST_BUILD
|
|
189
|
+
COMMAND ${CMAKE_COMMAND} -E make_directory "$<TARGET_FILE_DIR:{{PROJECT_NAME_LOWER}}>/frontend"
|
|
187
190
|
COMMAND ${CMAKE_COMMAND} -E copy_directory
|
|
188
191
|
"${CMAKE_SOURCE_DIR}/frontend/dist"
|
|
189
|
-
"$<TARGET_FILE_DIR:{{
|
|
192
|
+
"$<TARGET_FILE_DIR:{{PROJECT_NAME_LOWER}}>/frontend"
|
|
190
193
|
COMMENT "Copying frontend files to build directory"
|
|
191
194
|
)
|
|
192
195
|
endif()
|
|
@@ -23,7 +23,6 @@ using json = nlohmann::json;
|
|
|
23
23
|
struct AppConfig {
|
|
24
24
|
std::string name = "{{PROJECT_NAME}}";
|
|
25
25
|
std::string version = "0.1.0";
|
|
26
|
-
bool showWhenFrontendReady = true; // Hides blank webview until React mounts
|
|
27
26
|
} appConfig;
|
|
28
27
|
|
|
29
28
|
struct WindowConfig {
|
|
@@ -38,6 +37,7 @@ struct WindowConfig {
|
|
|
38
37
|
bool devTools = true;
|
|
39
38
|
bool scrollbars = false;
|
|
40
39
|
bool fileDrop = true; // Enable file drop from OS to webview
|
|
40
|
+
bool tray = true; // Enable system tray
|
|
41
41
|
std::string route = "/"; // Starting route
|
|
42
42
|
int devServerPort = 5173;
|
|
43
43
|
} windowConfig;
|
|
@@ -80,30 +80,28 @@ int main() {
|
|
|
80
80
|
.skipTaskbar(!windowConfig.showInTaskbar)
|
|
81
81
|
.scrollbars(windowConfig.scrollbars)
|
|
82
82
|
.fileDrop(windowConfig.fileDrop)
|
|
83
|
+
.tray(windowConfig.tray)
|
|
83
84
|
.centered(true)
|
|
84
85
|
.build();
|
|
85
86
|
|
|
86
87
|
// Icon from embedded assets
|
|
87
88
|
#ifdef ASSET_ICON_PNG
|
|
88
89
|
mainWindow.setIconFromMemory(ASSET_ICON_PNG, ASSET_ICON_PNG_LEN);
|
|
90
|
+
mainWindow.setTrayIconFromMemory(ASSET_ICON_PNG, ASSET_ICON_PNG_LEN);
|
|
89
91
|
#endif
|
|
90
92
|
|
|
91
|
-
// Hide until frontend signals it's ready (no blank flash)
|
|
92
|
-
if (appConfig.showWhenFrontendReady) {
|
|
93
|
-
mainWindow.hide();
|
|
94
|
-
}
|
|
95
|
-
|
|
96
93
|
// Wire up connect system (for custom frontend ↔ backend communication)
|
|
97
94
|
// Run `plusui connect` after adding custom connect methods
|
|
98
95
|
static Connect conn;
|
|
99
96
|
bindConnect(mainWindow, conn);
|
|
100
97
|
|
|
101
|
-
// Load frontend
|
|
98
|
+
// Load frontend then show.
|
|
102
99
|
#ifdef PLUSUI_DEV_MODE
|
|
103
100
|
mainWindow.navigate("http://localhost:" + std::to_string(windowConfig.devServerPort) + windowConfig.route);
|
|
104
101
|
#else
|
|
105
102
|
mainWindow.loadFile("frontend/dist/index.html" + (windowConfig.route == "/" ? "" : "#" + windowConfig.route));
|
|
106
103
|
#endif
|
|
104
|
+
mainWindow.show();
|
|
107
105
|
|
|
108
106
|
App runtime;
|
|
109
107
|
runtime.run();
|
|
@@ -5,12 +5,15 @@ if(POLICY CMP0141)
|
|
|
5
5
|
cmake_policy(SET CMP0141 NEW)
|
|
6
6
|
endif()
|
|
7
7
|
|
|
8
|
-
project({{
|
|
8
|
+
project({{PROJECT_NAME_LOWER}} VERSION {{PROJECT_VERSION}} LANGUAGES CXX)
|
|
9
9
|
|
|
10
10
|
set(CMAKE_CXX_STANDARD 20)
|
|
11
11
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
|
12
12
|
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
|
13
13
|
|
|
14
|
+
# Convert PROJECT_NAME to lowercase for executables
|
|
15
|
+
string(TOLOWER "{{PROJECT_NAME_LOWER}}" PROJECT_NAME_LOWER)
|
|
16
|
+
|
|
14
17
|
# Platform detection
|
|
15
18
|
if(WIN32)
|
|
16
19
|
add_definitions(-DPLUSUI_EDGE)
|
|
@@ -120,15 +123,15 @@ if(NOT EXISTS "${PLUSUI_CORE_DIR}/Features/FileDrop/filedrop.cpp")
|
|
|
120
123
|
endif()
|
|
121
124
|
|
|
122
125
|
# Create the executable
|
|
123
|
-
add_executable({{
|
|
126
|
+
add_executable({{PROJECT_NAME_LOWER}} main.cpp)
|
|
124
127
|
|
|
125
128
|
# Optional: Add your own C++ files here
|
|
126
129
|
# file(GLOB_RECURSE MY_SOURCES "features/*.cpp")
|
|
127
|
-
# target_sources({{
|
|
130
|
+
# target_sources({{PROJECT_NAME_LOWER}} PRIVATE ${MY_SOURCES})
|
|
128
131
|
|
|
129
132
|
# Link PlusUI library
|
|
130
|
-
target_link_libraries({{
|
|
131
|
-
target_include_directories({{
|
|
133
|
+
target_link_libraries({{PROJECT_NAME_LOWER}} PRIVATE plusui)
|
|
134
|
+
target_include_directories({{PROJECT_NAME_LOWER}} PRIVATE ${CMAKE_SOURCE_DIR})
|
|
132
135
|
|
|
133
136
|
# Platform-specific setup
|
|
134
137
|
if(WIN32)
|
|
@@ -147,26 +150,26 @@ if(WIN32)
|
|
|
147
150
|
|
|
148
151
|
if(WEBVIEW2_INCLUDE_DIR)
|
|
149
152
|
message(STATUS "Found WebView2 headers at: ${WEBVIEW2_INCLUDE_DIR}")
|
|
150
|
-
target_include_directories({{
|
|
153
|
+
target_include_directories({{PROJECT_NAME_LOWER}} PRIVATE ${WEBVIEW2_INCLUDE_DIR})
|
|
151
154
|
else()
|
|
152
155
|
message(WARNING "WebView2 headers not found. Building may fail.")
|
|
153
156
|
message(STATUS "Please install WebView2 SDK via NuGet:")
|
|
154
157
|
message(STATUS " nuget install Microsoft.Web.WebView2 -OutputDirectory packages")
|
|
155
158
|
endif()
|
|
156
159
|
|
|
157
|
-
target_link_libraries({{
|
|
160
|
+
target_link_libraries({{PROJECT_NAME_LOWER}} PRIVATE ole32 shell32 shlwapi user32 version)
|
|
158
161
|
# Keep default console subsystem so standard int main() works in all build modes.
|
|
159
162
|
elseif(APPLE)
|
|
160
163
|
# macOS: WebKit
|
|
161
164
|
find_library(WEBKIT_LIBRARY WebKit REQUIRED)
|
|
162
165
|
find_library(COCOA_LIBRARY Cocoa REQUIRED)
|
|
163
|
-
target_link_libraries({{
|
|
166
|
+
target_link_libraries({{PROJECT_NAME_LOWER}} PRIVATE ${WEBKIT_LIBRARY} ${COCOA_LIBRARY})
|
|
164
167
|
|
|
165
168
|
# Create app bundle for production
|
|
166
169
|
if(NOT PLUSUI_DEV_MODE)
|
|
167
|
-
set_target_properties({{
|
|
170
|
+
set_target_properties({{PROJECT_NAME_LOWER}} PROPERTIES
|
|
168
171
|
MACOSX_BUNDLE TRUE
|
|
169
|
-
MACOSX_BUNDLE_BUNDLE_NAME "{{
|
|
172
|
+
MACOSX_BUNDLE_BUNDLE_NAME "{{PROJECT_NAME_LOWER}}"
|
|
170
173
|
MACOSX_BUNDLE_BUNDLE_VERSION "{{PROJECT_VERSION}}"
|
|
171
174
|
MACOSX_BUNDLE_GUI_IDENTIFIER "com.plusui.{{PROJECT_NAME_LOWER}}"
|
|
172
175
|
)
|
|
@@ -176,17 +179,17 @@ else()
|
|
|
176
179
|
find_package(PkgConfig REQUIRED)
|
|
177
180
|
pkg_check_modules(GTK3 REQUIRED gtk+-3.0)
|
|
178
181
|
pkg_check_modules(WEBKIT2 REQUIRED webkit2gtk-4.0)
|
|
179
|
-
target_include_directories({{
|
|
180
|
-
target_link_libraries({{
|
|
182
|
+
target_include_directories({{PROJECT_NAME_LOWER}} PRIVATE ${GTK3_INCLUDE_DIRS} ${WEBKIT2_INCLUDE_DIRS})
|
|
183
|
+
target_link_libraries({{PROJECT_NAME_LOWER}} PRIVATE ${GTK3_LIBRARIES} ${WEBKIT2_LIBRARIES})
|
|
181
184
|
endif()
|
|
182
185
|
|
|
183
186
|
# Copy frontend dist files to build directory after build
|
|
184
187
|
if(EXISTS "${CMAKE_SOURCE_DIR}/frontend/dist")
|
|
185
|
-
add_custom_command(TARGET {{
|
|
186
|
-
COMMAND ${CMAKE_COMMAND} -E make_directory "$<TARGET_FILE_DIR:{{
|
|
188
|
+
add_custom_command(TARGET {{PROJECT_NAME_LOWER}} POST_BUILD
|
|
189
|
+
COMMAND ${CMAKE_COMMAND} -E make_directory "$<TARGET_FILE_DIR:{{PROJECT_NAME_LOWER}}>/frontend"
|
|
187
190
|
COMMAND ${CMAKE_COMMAND} -E copy_directory
|
|
188
191
|
"${CMAKE_SOURCE_DIR}/frontend/dist"
|
|
189
|
-
"$<TARGET_FILE_DIR:{{
|
|
192
|
+
"$<TARGET_FILE_DIR:{{PROJECT_NAME_LOWER}}>/frontend"
|
|
190
193
|
COMMENT "Copying frontend files to build directory"
|
|
191
194
|
)
|
|
192
195
|
endif()
|
|
@@ -23,7 +23,6 @@ using json = nlohmann::json;
|
|
|
23
23
|
struct AppConfig {
|
|
24
24
|
std::string name = "{{PROJECT_NAME}}";
|
|
25
25
|
std::string version = "0.1.0";
|
|
26
|
-
bool showWhenFrontendReady = true; // Hides blank webview until Solid mounts
|
|
27
26
|
} appConfig;
|
|
28
27
|
|
|
29
28
|
struct WindowConfig {
|
|
@@ -38,6 +37,7 @@ struct WindowConfig {
|
|
|
38
37
|
bool devTools = true;
|
|
39
38
|
bool scrollbars = false;
|
|
40
39
|
bool fileDrop = true; // Enable file drop from OS to webview
|
|
40
|
+
bool tray = true; // Enable system tray
|
|
41
41
|
std::string route = "/"; // Starting route
|
|
42
42
|
int devServerPort = 5173;
|
|
43
43
|
} windowConfig;
|
|
@@ -80,30 +80,28 @@ int main() {
|
|
|
80
80
|
.skipTaskbar(!windowConfig.showInTaskbar)
|
|
81
81
|
.scrollbars(windowConfig.scrollbars)
|
|
82
82
|
.fileDrop(windowConfig.fileDrop)
|
|
83
|
+
.tray(windowConfig.tray)
|
|
83
84
|
.centered(true)
|
|
84
85
|
.build();
|
|
85
86
|
|
|
86
87
|
// Icon from embedded assets
|
|
87
88
|
#ifdef ASSET_ICON_PNG
|
|
88
89
|
mainWindow.setIconFromMemory(ASSET_ICON_PNG, ASSET_ICON_PNG_LEN);
|
|
90
|
+
mainWindow.setTrayIconFromMemory(ASSET_ICON_PNG, ASSET_ICON_PNG_LEN);
|
|
89
91
|
#endif
|
|
90
92
|
|
|
91
|
-
// Hide until frontend signals it's ready (no blank flash)
|
|
92
|
-
if (appConfig.showWhenFrontendReady) {
|
|
93
|
-
mainWindow.hide();
|
|
94
|
-
}
|
|
95
|
-
|
|
96
93
|
// Wire up connect system (for custom frontend ↔ backend communication)
|
|
97
94
|
// Run `plusui connect` after adding custom connect methods
|
|
98
95
|
static Connect conn;
|
|
99
96
|
bindConnect(mainWindow, conn);
|
|
100
97
|
|
|
101
|
-
// Load frontend
|
|
98
|
+
// Load frontend then show.
|
|
102
99
|
#ifdef PLUSUI_DEV_MODE
|
|
103
100
|
mainWindow.navigate("http://localhost:" + std::to_string(windowConfig.devServerPort) + windowConfig.route);
|
|
104
101
|
#else
|
|
105
102
|
mainWindow.loadFile("frontend/dist/index.html" + (windowConfig.route == "/" ? "" : "#" + windowConfig.route));
|
|
106
103
|
#endif
|
|
104
|
+
mainWindow.show();
|
|
107
105
|
|
|
108
106
|
App runtime;
|
|
109
107
|
runtime.run();
|