plusui-native-core 0.1.104 → 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 (49) hide show
  1. package/Core/.claude/settings.local.json +7 -0
  2. package/Core/CMakeLists.txt +1 -1
  3. package/Core/Features/API/Connect_API.ts +20 -52
  4. package/Core/Features/API/app-api.ts +28 -28
  5. package/Core/Features/API/browser-api.ts +38 -38
  6. package/Core/Features/API/clipboard-api.ts +21 -21
  7. package/Core/Features/API/display-api.ts +33 -33
  8. package/Core/Features/API/keyboard-api.ts +33 -33
  9. package/Core/Features/API/menu-api.ts +39 -39
  10. package/Core/Features/API/router-api.ts +23 -23
  11. package/Core/Features/API/tray-api.ts +22 -22
  12. package/Core/Features/API/webgpu-api.ts +55 -55
  13. package/Core/Features/App/app.cpp +128 -102
  14. package/Core/Features/Browser/browser.cpp +227 -227
  15. package/Core/Features/Browser/browser.ts +161 -161
  16. package/Core/Features/Clipboard/clipboard.cpp +235 -235
  17. package/Core/Features/Display/display.cpp +212 -212
  18. package/Core/Features/FileDrop/filedrop.cpp +448 -324
  19. package/Core/Features/FileDrop/filedrop.css +421 -421
  20. package/Core/Features/FileDrop/filedrop.ts +5 -9
  21. package/Core/Features/Keyboard/keyboard_linux.cpp +4 -0
  22. package/Core/Features/Router/router.cpp +62 -62
  23. package/Core/Features/Router/router.ts +113 -113
  24. package/Core/Features/Tray/tray.cpp +328 -324
  25. package/Core/Features/WebGPU/webgpu.cpp +948 -948
  26. package/Core/Features/Window/webview.cpp +1026 -1014
  27. package/Core/Features/Window/webview.ts +516 -516
  28. package/Core/Features/Window/window.cpp +2265 -1988
  29. package/Core/include/plusui/api.hpp +237 -237
  30. package/Core/include/plusui/app.hpp +33 -33
  31. package/Core/include/plusui/browser.hpp +67 -67
  32. package/Core/include/plusui/clipboard.hpp +41 -41
  33. package/Core/include/plusui/connect.hpp +340 -340
  34. package/Core/include/plusui/connection.hpp +3 -3
  35. package/Core/include/plusui/display.hpp +90 -90
  36. package/Core/include/plusui/filedrop.hpp +92 -77
  37. package/Core/include/plusui/keyboard.hpp +112 -112
  38. package/Core/include/plusui/menu.hpp +153 -153
  39. package/Core/include/plusui/plusui +18 -18
  40. package/Core/include/plusui/router.hpp +42 -42
  41. package/Core/include/plusui/tray.hpp +94 -94
  42. package/Core/include/plusui/webgpu.hpp +434 -434
  43. package/Core/include/plusui/window.hpp +180 -177
  44. package/Core/scripts/generate-umbrella-header.mjs +77 -77
  45. package/Core/vendor/WebView2EnvironmentOptions.h +406 -406
  46. package/Core/vendor/webview.h +487 -487
  47. package/Core/vendor/webview2.h +52079 -52079
  48. package/README.md +19 -19
  49. package/package.json +1 -1
@@ -1,55 +1,55 @@
1
- /**
2
- * WebGPU API
3
- *
4
- * GPU-accelerated rendering and compute via the WebGPU standard.
5
- *
6
- * Actions:
7
- * gpu.requestAdapter(options?) - Request a GPU adapter (entry point for WebGPU)
8
- * gpu.getPreferredCanvasFormat() - Get the preferred swap-chain texture format
9
- *
10
- * Events:
11
- * gpu.onAdapterLost(cb) - Fires when the GPU adapter is lost
12
- * gpu.onDeviceLost(cb) - Fires when the GPU device is lost
13
- * gpu.onError(cb) - Fires on GPU errors
14
- *
15
- * Core types (mirrors the WebGPU spec):
16
- * GPUAdapter, GPUDevice, GPUBuffer, GPUTexture, GPUTextureView
17
- * GPUSampler, GPUShaderModule, GPURenderPipeline, GPUComputePipeline
18
- * GPUBindGroup, GPUBindGroupLayout, GPUCommandEncoder
19
- * GPURenderPassEncoder, GPUComputePassEncoder, GPUQueue, GPUCommandBuffer
20
- *
21
- * Usage flags / constants:
22
- * GPUBufferUsage, GPUTextureUsage, GPUMapMode, GPUShaderStage, GPUColorWrite
23
- */
24
-
25
- export type {
26
- GPUAdapter,
27
- GPUAdapterInfo,
28
- GPUDevice,
29
- GPUDeviceLostInfo,
30
- GPUBuffer,
31
- GPUTexture,
32
- GPUTextureView,
33
- GPUSampler,
34
- GPUShaderModule,
35
- GPURenderPipeline,
36
- GPUComputePipeline,
37
- GPUBindGroupLayout,
38
- GPUBindGroup,
39
- GPUCommandEncoder,
40
- GPURenderPassEncoder,
41
- GPUComputePassEncoder,
42
- GPUQueue,
43
- GPUCommandBuffer,
44
- GPURequestAdapterOptions,
45
- GPUDeviceDescriptor,
46
- } from '../WebGPU/webgpu';
47
-
48
- export {
49
- gpu,
50
- GPUBufferUsage,
51
- GPUTextureUsage,
52
- GPUMapMode,
53
- GPUShaderStage,
54
- GPUColorWrite,
55
- } from '../WebGPU/webgpu';
1
+ /**
2
+ * WebGPU API
3
+ *
4
+ * GPU-accelerated rendering and compute via the WebGPU standard.
5
+ *
6
+ * Actions:
7
+ * gpu.requestAdapter(options?) - Request a GPU adapter (entry point for WebGPU)
8
+ * gpu.getPreferredCanvasFormat() - Get the preferred swap-chain texture format
9
+ *
10
+ * Events:
11
+ * gpu.onAdapterLost(cb) - Fires when the GPU adapter is lost
12
+ * gpu.onDeviceLost(cb) - Fires when the GPU device is lost
13
+ * gpu.onError(cb) - Fires on GPU errors
14
+ *
15
+ * Core types (mirrors the WebGPU spec):
16
+ * GPUAdapter, GPUDevice, GPUBuffer, GPUTexture, GPUTextureView
17
+ * GPUSampler, GPUShaderModule, GPURenderPipeline, GPUComputePipeline
18
+ * GPUBindGroup, GPUBindGroupLayout, GPUCommandEncoder
19
+ * GPURenderPassEncoder, GPUComputePassEncoder, GPUQueue, GPUCommandBuffer
20
+ *
21
+ * Usage flags / constants:
22
+ * GPUBufferUsage, GPUTextureUsage, GPUMapMode, GPUShaderStage, GPUColorWrite
23
+ */
24
+
25
+ export type {
26
+ GPUAdapter,
27
+ GPUAdapterInfo,
28
+ GPUDevice,
29
+ GPUDeviceLostInfo,
30
+ GPUBuffer,
31
+ GPUTexture,
32
+ GPUTextureView,
33
+ GPUSampler,
34
+ GPUShaderModule,
35
+ GPURenderPipeline,
36
+ GPUComputePipeline,
37
+ GPUBindGroupLayout,
38
+ GPUBindGroup,
39
+ GPUCommandEncoder,
40
+ GPURenderPassEncoder,
41
+ GPUComputePassEncoder,
42
+ GPUQueue,
43
+ GPUCommandBuffer,
44
+ GPURequestAdapterOptions,
45
+ GPUDeviceDescriptor,
46
+ } from '../WebGPU/webgpu';
47
+
48
+ export {
49
+ gpu,
50
+ GPUBufferUsage,
51
+ GPUTextureUsage,
52
+ GPUMapMode,
53
+ GPUShaderStage,
54
+ GPUColorWrite,
55
+ } from '../WebGPU/webgpu';
@@ -1,82 +1,102 @@
1
- #ifdef _WIN32
2
- #define WIN32_LEAN_AND_MEAN
3
- #include <windows.h>
4
- #endif
5
-
6
- #include <plusui/plusui.hpp>
7
-
8
- namespace plusui {
9
-
10
- struct App::Impl {
11
- bool running = false;
12
- };
13
-
14
- App::App() : pImpl(std::make_unique<Impl>()) {}
15
- App::~App() = default;
16
-
17
- void App::run() {
18
- pImpl->running = true;
19
- #ifdef _WIN32
20
- MSG msg;
21
- while (GetMessage(&msg, nullptr, 0, 0)) {
22
- TranslateMessage(&msg);
23
- DispatchMessage(&msg);
24
- }
25
- #endif
26
- }
27
-
28
- void App::quit() {
29
- pImpl->running = false;
30
- #ifdef _WIN32
31
- PostQuitMessage(0);
32
- #endif
33
- }
34
-
35
- App::Builder::Builder() = default;
36
-
37
- App::Builder &App::Builder::title(const std::string &t) {
38
- config.title = t;
39
- return *this;
40
- }
41
- App::Builder &App::Builder::width(int w) {
42
- config.width = w;
43
- return *this;
44
- }
45
- App::Builder &App::Builder::height(int h) {
46
- config.height = h;
47
- return *this;
48
- }
49
- App::Builder &App::Builder::resizable(bool r) {
50
- config.resizable = r;
51
- return *this;
52
- }
53
- App::Builder &App::Builder::devtools(bool d) {
54
- config.devtools = d;
55
- return *this;
56
- }
57
- App::Builder &App::Builder::trayIcon(const std::string &icon) {
58
- config.trayIconPath = icon;
59
- return *this;
60
- }
61
- App::Builder &App::Builder::trayTooltip(const std::string &tooltip) {
62
- config.trayTooltip = tooltip;
63
- return *this;
64
- }
65
- App::Builder &App::Builder::alwaysOnTop(bool top) {
66
- config.alwaysOnTop = top;
67
- return *this;
68
- }
69
- App::Builder &App::Builder::centered(bool center) {
70
- config.centered = center;
71
- return *this;
72
- }
73
- App::Builder &App::Builder::transparent(bool transparent) {
74
- config.transparent = transparent;
75
- return *this;
76
- }
77
- App::Builder &App::Builder::decorations(bool decorations) {
78
- config.decorations = decorations;
79
- return *this;
1
+ #ifdef _WIN32
2
+ #define WIN32_LEAN_AND_MEAN
3
+ #include <windows.h>
4
+ #endif
5
+
6
+ #if defined(__APPLE__)
7
+ #import <Cocoa/Cocoa.h>
8
+ #endif
9
+
10
+ #if defined(__linux__)
11
+ #include <gtk/gtk.h>
12
+ #endif
13
+
14
+ #include <plusui/plusui.hpp>
15
+
16
+ namespace plusui {
17
+
18
+ struct App::Impl {
19
+ bool running = false;
20
+ };
21
+
22
+ App::App() : pImpl(std::make_unique<Impl>()) {}
23
+ App::~App() = default;
24
+
25
+ void App::run() {
26
+ pImpl->running = true;
27
+ #ifdef _WIN32
28
+ MSG msg;
29
+ while (GetMessage(&msg, nullptr, 0, 0)) {
30
+ TranslateMessage(&msg);
31
+ DispatchMessage(&msg);
32
+ }
33
+ #elif defined(__APPLE__)
34
+ // macOS: handled by NSApplicationMain or similar
35
+ while (pImpl->running) {
36
+ [[NSRunLoop currentRunLoop] runUntilDate:[NSDate dateWithTimeIntervalSinceNow:0.1]];
37
+ }
38
+ #else
39
+ // Linux: GTK main loop
40
+ gtk_main();
41
+ #endif
42
+ }
43
+
44
+ void App::quit() {
45
+ pImpl->running = false;
46
+ #ifdef _WIN32
47
+ PostQuitMessage(0);
48
+ #elif defined(__APPLE__)
49
+ // macOS: handled by NSApplication
50
+ #else
51
+ gtk_main_quit();
52
+ #endif
53
+ }
54
+
55
+ App::Builder::Builder() = default;
56
+
57
+ App::Builder &App::Builder::title(const std::string &t) {
58
+ config.title = t;
59
+ return *this;
60
+ }
61
+ App::Builder &App::Builder::width(int w) {
62
+ config.width = w;
63
+ return *this;
64
+ }
65
+ App::Builder &App::Builder::height(int h) {
66
+ config.height = h;
67
+ return *this;
68
+ }
69
+ App::Builder &App::Builder::resizable(bool r) {
70
+ config.resizable = r;
71
+ return *this;
72
+ }
73
+ App::Builder &App::Builder::devtools(bool d) {
74
+ config.devtools = d;
75
+ return *this;
76
+ }
77
+ App::Builder &App::Builder::trayIcon(const std::string &icon) {
78
+ config.trayIconPath = icon;
79
+ return *this;
80
+ }
81
+ App::Builder &App::Builder::trayTooltip(const std::string &tooltip) {
82
+ config.trayTooltip = tooltip;
83
+ return *this;
84
+ }
85
+ App::Builder &App::Builder::alwaysOnTop(bool top) {
86
+ config.alwaysOnTop = top;
87
+ return *this;
88
+ }
89
+ App::Builder &App::Builder::centered(bool center) {
90
+ config.centered = center;
91
+ return *this;
92
+ }
93
+ App::Builder &App::Builder::transparent(bool transparent) {
94
+ config.transparent = transparent;
95
+ return *this;
96
+ }
97
+ App::Builder &App::Builder::decorations(bool decorations) {
98
+ config.decorations = decorations;
99
+ return *this;
80
100
  }
81
101
  App::Builder &App::Builder::skipTaskbar(bool skip) {
82
102
  config.skipTaskbar = skip;
@@ -109,26 +129,32 @@ Window App::Builder::build() {
109
129
  winConfig.scrollbars = config.scrollbars;
110
130
  winConfig.disableWebviewDragDrop =
111
131
  config.fileDrop; // Auto-disable browser drag-drop when OS file drop enabled
112
-
113
- // Create native window
114
- auto nativeWinPtr = std::make_shared<Window>(Window::create(winConfig));
115
- nativeWinPtr->show();
116
-
117
- // Create embedded webview window inside the native window
118
- Window webviewWin = Window::create(nativeWinPtr->nativeHandle(), winConfig);
119
- webviewWin.setWindow(nativeWinPtr);
120
-
121
- if (!config.trayIconPath.empty()) {
122
- nativeWinPtr->tray().setIcon(config.trayIconPath);
123
- nativeWinPtr->tray().setVisible(true);
124
- if (!config.trayTooltip.empty()) {
125
- nativeWinPtr->tray().setTooltip(config.trayTooltip);
126
- }
127
- }
128
-
129
- return webviewWin;
130
- }
131
-
132
- App::Builder createApp() { return App::Builder(); }
133
-
134
- } // namespace plusui
132
+
133
+ // Create native window (do not show yet — caller controls visibility)
134
+ auto nativeWinPtr = std::make_shared<Window>(Window::create(winConfig));
135
+
136
+ // Create embedded webview window inside the native window
137
+ Window webviewWin = Window::create(nativeWinPtr->nativeHandle(), winConfig);
138
+ webviewWin.setWindow(nativeWinPtr);
139
+
140
+ if (config.fileDrop) {
141
+ plusui::FileDrop::instance().attach(
142
+ nativeWinPtr->nativeHandle(),
143
+ webviewWin.nativeWebView()
144
+ );
145
+ }
146
+
147
+ if (!config.trayIconPath.empty()) {
148
+ nativeWinPtr->tray().setIcon(config.trayIconPath);
149
+ nativeWinPtr->tray().setVisible(true);
150
+ if (!config.trayTooltip.empty()) {
151
+ nativeWinPtr->tray().setTooltip(config.trayTooltip);
152
+ }
153
+ }
154
+
155
+ return webviewWin;
156
+ }
157
+
158
+ App::Builder createApp() { return App::Builder(); }
159
+
160
+ } // namespace plusui