plusui-native-core 0.1.105 → 0.1.106

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.
Files changed (48) hide show
  1. package/Core/.claude/settings.local.json +7 -0
  2. package/Core/CMakeLists.txt +1 -1
  3. package/Core/Features/API/app-api.ts +28 -28
  4. package/Core/Features/API/browser-api.ts +38 -38
  5. package/Core/Features/API/clipboard-api.ts +21 -21
  6. package/Core/Features/API/display-api.ts +33 -33
  7. package/Core/Features/API/keyboard-api.ts +33 -33
  8. package/Core/Features/API/menu-api.ts +39 -39
  9. package/Core/Features/API/router-api.ts +23 -23
  10. package/Core/Features/API/tray-api.ts +22 -22
  11. package/Core/Features/API/webgpu-api.ts +55 -55
  12. package/Core/Features/App/app.cpp +128 -102
  13. package/Core/Features/Browser/browser.cpp +227 -227
  14. package/Core/Features/Browser/browser.ts +161 -161
  15. package/Core/Features/Clipboard/clipboard.cpp +235 -235
  16. package/Core/Features/Display/display.cpp +212 -212
  17. package/Core/Features/FileDrop/filedrop.cpp +448 -324
  18. package/Core/Features/FileDrop/filedrop.css +421 -421
  19. package/Core/Features/FileDrop/filedrop.ts +0 -7
  20. package/Core/Features/Keyboard/keyboard_linux.cpp +4 -0
  21. package/Core/Features/Router/router.cpp +62 -62
  22. package/Core/Features/Router/router.ts +113 -113
  23. package/Core/Features/Tray/tray.cpp +328 -324
  24. package/Core/Features/WebGPU/webgpu.cpp +948 -948
  25. package/Core/Features/Window/webview.cpp +1009 -1009
  26. package/Core/Features/Window/webview.ts +516 -516
  27. package/Core/Features/Window/window.cpp +2240 -1986
  28. package/Core/include/plusui/api.hpp +237 -237
  29. package/Core/include/plusui/app.hpp +33 -33
  30. package/Core/include/plusui/browser.hpp +67 -67
  31. package/Core/include/plusui/clipboard.hpp +41 -41
  32. package/Core/include/plusui/connect.hpp +340 -340
  33. package/Core/include/plusui/connection.hpp +3 -3
  34. package/Core/include/plusui/display.hpp +90 -90
  35. package/Core/include/plusui/filedrop.hpp +92 -77
  36. package/Core/include/plusui/keyboard.hpp +112 -112
  37. package/Core/include/plusui/menu.hpp +153 -153
  38. package/Core/include/plusui/plusui +18 -18
  39. package/Core/include/plusui/router.hpp +42 -42
  40. package/Core/include/plusui/tray.hpp +94 -94
  41. package/Core/include/plusui/webgpu.hpp +434 -434
  42. package/Core/include/plusui/window.hpp +180 -177
  43. package/Core/scripts/generate-umbrella-header.mjs +77 -77
  44. package/Core/vendor/WebView2EnvironmentOptions.h +406 -406
  45. package/Core/vendor/webview.h +487 -487
  46. package/Core/vendor/webview2.h +52079 -52079
  47. package/README.md +19 -19
  48. package/package.json +1 -1
@@ -67,13 +67,6 @@ g.__plusui_fileDrop__ = function(zoneName: string, files: FileInfo[]) {
67
67
  }
68
68
  };
69
69
 
70
- g.__plusui_fileDrop_default__ = function(files: FileInfo[]) {
71
- for (const zone of zones.values()) {
72
- const cb = (zone as any).__onFiles;
73
- if (cb) cb(files);
74
- }
75
- };
76
-
77
70
  async function invoke<T>(method: string, params: any[] = []): Promise<T> {
78
71
  return new Promise((resolve, reject) => {
79
72
  const id = String(++callId);
@@ -27,6 +27,10 @@
27
27
  #include <thread>
28
28
  #include <atomic>
29
29
 
30
+ #ifdef None
31
+ #undef None
32
+ #endif
33
+
30
34
  namespace plusui {
31
35
 
32
36
  // ── Modifier state ────────────────────────────────────────────────────────────
@@ -1,62 +1,62 @@
1
- #include <plusui/router.hpp>
2
-
3
- namespace plusui {
4
-
5
- struct Router::Impl {
6
- std::map<std::string, std::string> routes;
7
- std::string initialRoute = "/";
8
- std::map<std::string, std::string> currentRoutes;
9
- std::vector<RouteChangeCallback> callbacks;
10
- };
11
-
12
- Router::Router() : pImpl(std::make_unique<Impl>()) {}
13
- Router::~Router() = default;
14
-
15
- Router& Router::instance() {
16
- static Router router;
17
- return router;
18
- }
19
-
20
- void Router::setRoutes(const std::map<std::string, std::string>& routes) {
21
- pImpl->routes = routes;
22
- }
23
-
24
- std::map<std::string, std::string> Router::getRoutes() const {
25
- return pImpl->routes;
26
- }
27
-
28
- void Router::push(const std::string& route, const std::string& windowId) {
29
- std::string wid = windowId.empty() ? "__main__" : windowId;
30
- pImpl->currentRoutes[wid] = route;
31
- for (auto& cb : pImpl->callbacks) {
32
- cb(route, wid);
33
- }
34
- }
35
-
36
- void Router::replace(const std::string& route, const std::string& windowId) {
37
- std::string wid = windowId.empty() ? "__main__" : windowId;
38
- pImpl->currentRoutes[wid] = route;
39
- for (auto& cb : pImpl->callbacks) {
40
- cb(route, wid);
41
- }
42
- }
43
-
44
- std::string Router::getCurrentRoute(const std::string& windowId) const {
45
- std::string wid = windowId.empty() ? "__main__" : windowId;
46
- auto it = pImpl->currentRoutes.find(wid);
47
- if (it != pImpl->currentRoutes.end()) {
48
- return it->second;
49
- }
50
- return pImpl->initialRoute;
51
- }
52
-
53
- void Router::setInitialRoute(const std::string& route) {
54
- pImpl->initialRoute = route;
55
- pImpl->currentRoutes["__main__"] = route;
56
- }
57
-
58
- void Router::onRouteChange(RouteChangeCallback callback) {
59
- pImpl->callbacks.push_back(std::move(callback));
60
- }
61
-
62
- } // namespace plusui
1
+ #include <plusui/router.hpp>
2
+
3
+ namespace plusui {
4
+
5
+ struct Router::Impl {
6
+ std::map<std::string, std::string> routes;
7
+ std::string initialRoute = "/";
8
+ std::map<std::string, std::string> currentRoutes;
9
+ std::vector<RouteChangeCallback> callbacks;
10
+ };
11
+
12
+ Router::Router() : pImpl(std::make_unique<Impl>()) {}
13
+ Router::~Router() = default;
14
+
15
+ Router& Router::instance() {
16
+ static Router router;
17
+ return router;
18
+ }
19
+
20
+ void Router::setRoutes(const std::map<std::string, std::string>& routes) {
21
+ pImpl->routes = routes;
22
+ }
23
+
24
+ std::map<std::string, std::string> Router::getRoutes() const {
25
+ return pImpl->routes;
26
+ }
27
+
28
+ void Router::push(const std::string& route, const std::string& windowId) {
29
+ std::string wid = windowId.empty() ? "__main__" : windowId;
30
+ pImpl->currentRoutes[wid] = route;
31
+ for (auto& cb : pImpl->callbacks) {
32
+ cb(route, wid);
33
+ }
34
+ }
35
+
36
+ void Router::replace(const std::string& route, const std::string& windowId) {
37
+ std::string wid = windowId.empty() ? "__main__" : windowId;
38
+ pImpl->currentRoutes[wid] = route;
39
+ for (auto& cb : pImpl->callbacks) {
40
+ cb(route, wid);
41
+ }
42
+ }
43
+
44
+ std::string Router::getCurrentRoute(const std::string& windowId) const {
45
+ std::string wid = windowId.empty() ? "__main__" : windowId;
46
+ auto it = pImpl->currentRoutes.find(wid);
47
+ if (it != pImpl->currentRoutes.end()) {
48
+ return it->second;
49
+ }
50
+ return pImpl->initialRoute;
51
+ }
52
+
53
+ void Router::setInitialRoute(const std::string& route) {
54
+ pImpl->initialRoute = route;
55
+ pImpl->currentRoutes["__main__"] = route;
56
+ }
57
+
58
+ void Router::onRouteChange(RouteChangeCallback callback) {
59
+ pImpl->callbacks.push_back(std::move(callback));
60
+ }
61
+
62
+ } // namespace plusui
@@ -1,113 +1,113 @@
1
- import type { WindowId } from '../Window/window';
2
-
3
- // ─── Types ───────────────────────────────────────────────────────────────────
4
-
5
- export type RouteMap = Record<string, string>;
6
- export type RouteChangeCallback = (route: string, windowId?: WindowId) => void;
7
-
8
- export interface RouteConfig {
9
- /** Map of route paths → frontend URLs (e.g. { '/': 'http://localhost:5173', '/settings': 'http://localhost:5173/settings' }) */
10
- routes: RouteMap;
11
- /** Initial route to load on startup (default: '/') */
12
- initialRoute?: string;
13
- }
14
-
15
- // ─── Internal state ──────────────────────────────────────────────────────────
16
-
17
- let _invoke: ((method: string, args?: unknown[]) => Promise<unknown>) | null = null;
18
- let _routes: RouteMap = {};
19
- let _currentRoutes: Record<string, string> = {}; // windowId → current route
20
- const _routeChangeCallbacks: RouteChangeCallback[] = [];
21
-
22
- // ─── Bridge ──────────────────────────────────────────────────────────────────
23
-
24
- export function setInvokeFn(fn: (method: string, args?: unknown[]) => Promise<unknown>) {
25
- _invoke = fn;
26
- }
27
-
28
- async function invoke(method: string, args?: unknown[]): Promise<unknown> {
29
- if (!_invoke) {
30
- if (typeof window !== 'undefined' && (window as any).__invoke__) {
31
- _invoke = (window as any).__invoke__;
32
- } else {
33
- console.warn(`[PlusUI] Router API not initialized: __invoke__ missing. Running in mock mode for '${method}'.`);
34
- return Promise.resolve(null);
35
- }
36
- }
37
- return _invoke!(method, args);
38
- }
39
-
40
- // Listen for route changes from C++ backend
41
- if (typeof window !== 'undefined') {
42
- (window as any).__onRouteChange__ = (route: string, windowId?: string) => {
43
- const wid = windowId || '__main__';
44
- _currentRoutes[wid] = route;
45
- _routeChangeCallbacks.forEach(cb => cb(route, windowId));
46
- };
47
- }
48
-
49
- // ─── Router API ──────────────────────────────────────────────────────────────
50
-
51
- export const router = {
52
- /**
53
- * Define route map — maps route paths to frontend URLs.
54
- * Works with any frontend router (React Router, TanStack, Solid Router, etc.)
55
- */
56
- setRoutes(routes: RouteMap): void {
57
- _routes = routes;
58
- void invoke('router.setRoutes', [routes]);
59
- },
60
-
61
- /** Get the current route map */
62
- getRoutes(): RouteMap {
63
- return { ..._routes };
64
- },
65
-
66
- /**
67
- * Navigate to a route. The C++ backend loads the mapped URL into the window.
68
- * @param route Route path (e.g. '/settings')
69
- * @param windowId Optional target window (default: main window)
70
- */
71
- async push(route: string, windowId?: WindowId): Promise<void> {
72
- const wid = windowId || '__main__';
73
- _currentRoutes[wid] = route;
74
- const url = _routes[route] || route;
75
- await invoke('router.push', windowId ? [url, windowId] : [url]);
76
- },
77
-
78
- /**
79
- * Replace the current route without adding to history.
80
- * @param route Route path
81
- * @param windowId Optional target window
82
- */
83
- async replace(route: string, windowId?: WindowId): Promise<void> {
84
- const wid = windowId || '__main__';
85
- _currentRoutes[wid] = route;
86
- const url = _routes[route] || route;
87
- await invoke('router.replace', windowId ? [url, windowId] : [url]);
88
- },
89
-
90
- /** Get the current route for a window */
91
- getCurrentRoute(windowId?: WindowId): string {
92
- const wid = windowId || '__main__';
93
- return _currentRoutes[wid] || '/';
94
- },
95
-
96
- /** Set the initial route loaded on startup */
97
- async setInitialRoute(route: string): Promise<void> {
98
- _currentRoutes['__main__'] = route;
99
- const url = _routes[route] || route;
100
- await invoke('router.setInitialRoute', [url]);
101
- },
102
-
103
- /** Listen for route changes (from C++ backend or other windows) */
104
- onRouteChange(callback: RouteChangeCallback): () => void {
105
- _routeChangeCallbacks.push(callback);
106
- return () => {
107
- const idx = _routeChangeCallbacks.indexOf(callback);
108
- if (idx > -1) _routeChangeCallbacks.splice(idx, 1);
109
- };
110
- },
111
- };
112
-
113
- export default router;
1
+ import type { WindowId } from '../Window/window';
2
+
3
+ // ─── Types ───────────────────────────────────────────────────────────────────
4
+
5
+ export type RouteMap = Record<string, string>;
6
+ export type RouteChangeCallback = (route: string, windowId?: WindowId) => void;
7
+
8
+ export interface RouteConfig {
9
+ /** Map of route paths → frontend URLs (e.g. { '/': 'http://localhost:5173', '/settings': 'http://localhost:5173/settings' }) */
10
+ routes: RouteMap;
11
+ /** Initial route to load on startup (default: '/') */
12
+ initialRoute?: string;
13
+ }
14
+
15
+ // ─── Internal state ──────────────────────────────────────────────────────────
16
+
17
+ let _invoke: ((method: string, args?: unknown[]) => Promise<unknown>) | null = null;
18
+ let _routes: RouteMap = {};
19
+ let _currentRoutes: Record<string, string> = {}; // windowId → current route
20
+ const _routeChangeCallbacks: RouteChangeCallback[] = [];
21
+
22
+ // ─── Bridge ──────────────────────────────────────────────────────────────────
23
+
24
+ export function setInvokeFn(fn: (method: string, args?: unknown[]) => Promise<unknown>) {
25
+ _invoke = fn;
26
+ }
27
+
28
+ async function invoke(method: string, args?: unknown[]): Promise<unknown> {
29
+ if (!_invoke) {
30
+ if (typeof window !== 'undefined' && (window as any).__invoke__) {
31
+ _invoke = (window as any).__invoke__;
32
+ } else {
33
+ console.warn(`[PlusUI] Router API not initialized: __invoke__ missing. Running in mock mode for '${method}'.`);
34
+ return Promise.resolve(null);
35
+ }
36
+ }
37
+ return _invoke!(method, args);
38
+ }
39
+
40
+ // Listen for route changes from C++ backend
41
+ if (typeof window !== 'undefined') {
42
+ (window as any).__onRouteChange__ = (route: string, windowId?: string) => {
43
+ const wid = windowId || '__main__';
44
+ _currentRoutes[wid] = route;
45
+ _routeChangeCallbacks.forEach(cb => cb(route, windowId));
46
+ };
47
+ }
48
+
49
+ // ─── Router API ──────────────────────────────────────────────────────────────
50
+
51
+ export const router = {
52
+ /**
53
+ * Define route map — maps route paths to frontend URLs.
54
+ * Works with any frontend router (React Router, TanStack, Solid Router, etc.)
55
+ */
56
+ setRoutes(routes: RouteMap): void {
57
+ _routes = routes;
58
+ void invoke('router.setRoutes', [routes]);
59
+ },
60
+
61
+ /** Get the current route map */
62
+ getRoutes(): RouteMap {
63
+ return { ..._routes };
64
+ },
65
+
66
+ /**
67
+ * Navigate to a route. The C++ backend loads the mapped URL into the window.
68
+ * @param route Route path (e.g. '/settings')
69
+ * @param windowId Optional target window (default: main window)
70
+ */
71
+ async push(route: string, windowId?: WindowId): Promise<void> {
72
+ const wid = windowId || '__main__';
73
+ _currentRoutes[wid] = route;
74
+ const url = _routes[route] || route;
75
+ await invoke('router.push', windowId ? [url, windowId] : [url]);
76
+ },
77
+
78
+ /**
79
+ * Replace the current route without adding to history.
80
+ * @param route Route path
81
+ * @param windowId Optional target window
82
+ */
83
+ async replace(route: string, windowId?: WindowId): Promise<void> {
84
+ const wid = windowId || '__main__';
85
+ _currentRoutes[wid] = route;
86
+ const url = _routes[route] || route;
87
+ await invoke('router.replace', windowId ? [url, windowId] : [url]);
88
+ },
89
+
90
+ /** Get the current route for a window */
91
+ getCurrentRoute(windowId?: WindowId): string {
92
+ const wid = windowId || '__main__';
93
+ return _currentRoutes[wid] || '/';
94
+ },
95
+
96
+ /** Set the initial route loaded on startup */
97
+ async setInitialRoute(route: string): Promise<void> {
98
+ _currentRoutes['__main__'] = route;
99
+ const url = _routes[route] || route;
100
+ await invoke('router.setInitialRoute', [url]);
101
+ },
102
+
103
+ /** Listen for route changes (from C++ backend or other windows) */
104
+ onRouteChange(callback: RouteChangeCallback): () => void {
105
+ _routeChangeCallbacks.push(callback);
106
+ return () => {
107
+ const idx = _routeChangeCallbacks.indexOf(callback);
108
+ if (idx > -1) _routeChangeCallbacks.splice(idx, 1);
109
+ };
110
+ },
111
+ };
112
+
113
+ export default router;