plusui-native 0.2.73 → 0.2.74
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
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "plusui-native",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.74",
|
|
4
4
|
"description": "PlusUI CLI - Build C++ desktop apps modern UI ",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -27,11 +27,11 @@
|
|
|
27
27
|
"semver": "^7.6.0",
|
|
28
28
|
"which": "^4.0.0",
|
|
29
29
|
"execa": "^8.0.1",
|
|
30
|
-
"plusui-native-builder": "^0.1.
|
|
31
|
-
"plusui-native-connect": "^0.1.
|
|
30
|
+
"plusui-native-builder": "^0.1.73",
|
|
31
|
+
"plusui-native-connect": "^0.1.73"
|
|
32
32
|
},
|
|
33
33
|
"peerDependencies": {
|
|
34
|
-
"plusui-native-connect": "^0.1.
|
|
34
|
+
"plusui-native-connect": "^0.1.73"
|
|
35
35
|
},
|
|
36
36
|
"publishConfig": {
|
|
37
37
|
"access": "public"
|
|
@@ -114,12 +114,13 @@ struct WebGPUConfig {
|
|
|
114
114
|
// MAIN - Application Entry Point
|
|
115
115
|
// ============================================================================
|
|
116
116
|
// ── Connect instance ─────────────────────────────────────────────────────────
|
|
117
|
-
//
|
|
117
|
+
// conn is the bridge between C++ and the frontend.
|
|
118
118
|
// Run `plusui connect` to generate Connections/ from your name.on / name.emit usage.
|
|
119
|
-
//
|
|
120
|
-
//
|
|
121
|
-
//
|
|
122
|
-
static Connect
|
|
119
|
+
// Call initChannels(conn) once, then use channels directly:
|
|
120
|
+
// customFileDrop.on([](const json& p) { ... });
|
|
121
|
+
// customFileDrop.emit({{"value", 42}});
|
|
122
|
+
static Connect conn;
|
|
123
|
+
using json = nlohmann::json;
|
|
123
124
|
|
|
124
125
|
int main() {
|
|
125
126
|
// Build the app with configuration
|
|
@@ -191,12 +192,12 @@ int main() {
|
|
|
191
192
|
// ========================================
|
|
192
193
|
// CONNECT — bind frontend ↔ backend
|
|
193
194
|
// ========================================
|
|
194
|
-
// Wires the connect object to this window
|
|
195
|
-
//
|
|
196
|
-
//
|
|
197
|
-
//
|
|
198
|
-
bindConnect(mainWindow,
|
|
199
|
-
|
|
195
|
+
// Wires the connect object to this window, then initialises
|
|
196
|
+
// the auto-generated channels so you can use them directly:
|
|
197
|
+
// customFileDrop.on([](const json& p) { ... });
|
|
198
|
+
// customFileDrop.emit({{"value", 42}});
|
|
199
|
+
bindConnect(mainWindow, conn);
|
|
200
|
+
initChannels(conn);
|
|
200
201
|
|
|
201
202
|
// ========================================
|
|
202
203
|
// CUSTOM FILE DROP CHANNEL
|
|
@@ -205,7 +206,7 @@ int main() {
|
|
|
205
206
|
// Frontend drops files → emits via customFileDrop.emit({ files: [...] })
|
|
206
207
|
// C++ receives here, processes, then emits back to the frontend.
|
|
207
208
|
// Frontend receives the reply via customFileDrop.on() in App.tsx.
|
|
208
|
-
|
|
209
|
+
customFileDrop.on([](const json& payload) {
|
|
209
210
|
auto files = payload.value("files", json::array());
|
|
210
211
|
int count = static_cast<int>(files.size());
|
|
211
212
|
std::cout << "customFileDrop: received " << count << " file(s) from frontend" << std::endl;
|
|
@@ -213,7 +214,7 @@ int main() {
|
|
|
213
214
|
std::cout << " - " << f.value("name", "?") << " (" << f.value("size", 0) << " bytes)" << std::endl;
|
|
214
215
|
}
|
|
215
216
|
// Reply back to frontend — received by customFileDrop.on() in App.tsx
|
|
216
|
-
|
|
217
|
+
customFileDrop.emit({
|
|
217
218
|
{"processed", true},
|
|
218
219
|
{"count", count},
|
|
219
220
|
{"message", "C++ received " + std::to_string(count) + " file(s)"}
|
|
@@ -237,10 +238,10 @@ int main() {
|
|
|
237
238
|
//
|
|
238
239
|
// CONNECT (custom channels — same API on both sides):
|
|
239
240
|
// Run `plusui connect` to generate Connections/ from your name.on / name.emit calls.
|
|
240
|
-
// C++:
|
|
241
|
-
//
|
|
242
|
-
// TS:
|
|
243
|
-
//
|
|
241
|
+
// C++: customFileDrop.on([](const json& p) { ... }); // receive
|
|
242
|
+
// customFileDrop.emit({{"value", 42}}); // send
|
|
243
|
+
// TS: customFileDrop.on((data) => { ... }); // receive
|
|
244
|
+
// customFileDrop.emit({ value: 42 }); // send
|
|
244
245
|
//
|
|
245
246
|
// WINDOW: win.minimize(), win.maximize(), win.close(), win.center(),
|
|
246
247
|
// win.setSize(w, h), win.setPosition(x, y), win.setTitle(str),
|
|
@@ -113,12 +113,13 @@ struct WebGPUConfig {
|
|
|
113
113
|
// MAIN - Application Entry Point
|
|
114
114
|
// ============================================================================
|
|
115
115
|
// ── Connect instance ─────────────────────────────────────────────────────────
|
|
116
|
-
//
|
|
116
|
+
// conn is the bridge between C++ and the frontend.
|
|
117
117
|
// Run `plusui connect` to generate Connections/ from your name.on / name.emit usage.
|
|
118
|
-
//
|
|
119
|
-
//
|
|
120
|
-
//
|
|
121
|
-
static Connect
|
|
118
|
+
// Call initChannels(conn) once, then use channels directly:
|
|
119
|
+
// customFileDrop.on([](const json& p) { ... });
|
|
120
|
+
// customFileDrop.emit({{"value", 42}});
|
|
121
|
+
static Connect conn;
|
|
122
|
+
using json = nlohmann::json;
|
|
122
123
|
|
|
123
124
|
int main() {
|
|
124
125
|
// Build the app with configuration
|
|
@@ -185,12 +186,12 @@ int main() {
|
|
|
185
186
|
// ========================================
|
|
186
187
|
// CONNECT — bind frontend ↔ backend
|
|
187
188
|
// ========================================
|
|
188
|
-
// Wires the connect object to this window
|
|
189
|
-
//
|
|
190
|
-
//
|
|
191
|
-
//
|
|
192
|
-
bindConnect(mainWindow,
|
|
193
|
-
|
|
189
|
+
// Wires the connect object to this window, then initialises
|
|
190
|
+
// the auto-generated channels so you can use them directly:
|
|
191
|
+
// customFileDrop.on([](const json& p) { ... });
|
|
192
|
+
// customFileDrop.emit({{"value", 42}});
|
|
193
|
+
bindConnect(mainWindow, conn);
|
|
194
|
+
initChannels(conn);
|
|
194
195
|
|
|
195
196
|
// ========================================
|
|
196
197
|
// CUSTOM FILE DROP CHANNEL
|
|
@@ -199,7 +200,7 @@ int main() {
|
|
|
199
200
|
// Frontend drops files → emits via customFileDrop.emit({ files: [...] })
|
|
200
201
|
// C++ receives here, processes, then emits back to the frontend.
|
|
201
202
|
// Frontend receives the reply via customFileDrop.on() in App.tsx.
|
|
202
|
-
|
|
203
|
+
customFileDrop.on([](const json& payload) {
|
|
203
204
|
auto files = payload.value("files", json::array());
|
|
204
205
|
int count = static_cast<int>(files.size());
|
|
205
206
|
std::cout << "customFileDrop: received " << count << " file(s) from frontend" << std::endl;
|
|
@@ -207,7 +208,7 @@ int main() {
|
|
|
207
208
|
std::cout << " - " << f.value("name", "?") << " (" << f.value("size", 0) << " bytes)" << std::endl;
|
|
208
209
|
}
|
|
209
210
|
// Reply back to frontend — received by customFileDrop.on() in App.tsx
|
|
210
|
-
|
|
211
|
+
customFileDrop.emit({
|
|
211
212
|
{"processed", true},
|
|
212
213
|
{"count", count},
|
|
213
214
|
{"message", "C++ received " + std::to_string(count) + " file(s)"}
|
|
@@ -231,10 +232,10 @@ int main() {
|
|
|
231
232
|
//
|
|
232
233
|
// CONNECT (custom channels — same API on both sides):
|
|
233
234
|
// Run `plusui connect` to generate Connections/ from your name.on / name.emit calls.
|
|
234
|
-
// C++:
|
|
235
|
-
//
|
|
236
|
-
// TS:
|
|
237
|
-
//
|
|
235
|
+
// C++: customFileDrop.on([](const json& p) { ... }); // receive
|
|
236
|
+
// customFileDrop.emit({{"value", 42}}); // send
|
|
237
|
+
// TS: customFileDrop.on((data) => { ... }); // receive
|
|
238
|
+
// customFileDrop.emit({ value: 42 }); // send
|
|
238
239
|
//
|
|
239
240
|
// WINDOW: win.minimize(), win.maximize(), win.close(), win.center(),
|
|
240
241
|
// win.setSize(w, h), win.setPosition(x, y), win.setTitle(str),
|