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
@@ -1,235 +1,235 @@
1
- #include <memory>
2
- #include <mutex>
3
- #include <plusui/clipboard.hpp>
4
-
5
- #ifdef _WIN32
6
- #define WIN32_LEAN_AND_MEAN
7
- #include <windows.h>
8
- #elif defined(__APPLE__)
9
- #include <AppKit/AppKit.h>
10
- #include <CoreFoundation/CoreFoundation.h>
11
- #else
12
- // Linux/GTK - would use GTK clipboard APIs
13
- #include <gtk/gtk.h>
14
- #endif
15
-
16
- namespace PlusUI {
17
-
18
- struct Clipboard::Impl {
19
- std::mutex mtx;
20
- std::function<void(const std::string &)> changeCallback;
21
-
22
- #ifdef _WIN32
23
- HWND hwnd = nullptr;
24
- #endif
25
- };
26
-
27
- Clipboard::Clipboard() : pImpl(new Impl()) {
28
- #ifdef _WIN32
29
- // Create hidden window for clipboard monitoring
30
- // This would be done properly in a full implementation
31
- #endif
32
- }
33
-
34
- Clipboard::~Clipboard() { delete pImpl; }
35
-
36
- std::string Clipboard::getText() {
37
- std::lock_guard<std::mutex> lock(pImpl->mtx);
38
-
39
- #ifdef _WIN32
40
- if (!OpenClipboard(nullptr)) {
41
- return "";
42
- }
43
-
44
- HANDLE hData = GetClipboardData(CF_UNICODETEXT);
45
- if (hData == nullptr) {
46
- CloseClipboard();
47
- return "";
48
- }
49
-
50
- wchar_t *pszText = static_cast<wchar_t *>(GlobalLock(hData));
51
- if (pszText == nullptr) {
52
- CloseClipboard();
53
- return "";
54
- }
55
-
56
- // Convert wide string to UTF-8
57
- int size = WideCharToMultiByte(CP_UTF8, 0, pszText, -1, nullptr, 0, nullptr,
58
- nullptr);
59
- std::string text(size - 1, '\0');
60
- WideCharToMultiByte(CP_UTF8, 0, pszText, -1, &text[0], size, nullptr,
61
- nullptr);
62
-
63
- GlobalUnlock(hData);
64
- CloseClipboard();
65
-
66
- return text;
67
-
68
- #elif defined(__APPLE__)
69
- @autoreleasepool {
70
- NSPasteboard *pasteboard = [NSPasteboard generalPasteboard];
71
- NSString *str = [pasteboard stringForType:NSPasteboardTypeString];
72
- if (str) {
73
- return std::string([str UTF8String]);
74
- }
75
- return "";
76
- }
77
-
78
- #else
79
- // Linux/GTK implementation
80
- if (!gtk_init_check(nullptr, nullptr)) {
81
- return "";
82
- }
83
-
84
- GtkClipboard *clipboard = gtk_clipboard_get(GDK_SELECTION_CLIPBOARD);
85
- gchar *text = gtk_clipboard_wait_for_text(clipboard);
86
-
87
- std::string result;
88
- if (text) {
89
- result = text;
90
- g_free(text);
91
- }
92
-
93
- return result;
94
- #endif
95
- }
96
-
97
- void Clipboard::setText(const std::string &text) {
98
- std::lock_guard<std::mutex> lock(pImpl->mtx);
99
-
100
- #ifdef _WIN32
101
- if (!OpenClipboard(nullptr)) {
102
- return;
103
- }
104
-
105
- EmptyClipboard();
106
-
107
- // Convert UTF-8 to wide string
108
- int size = MultiByteToWideChar(CP_UTF8, 0, text.c_str(), -1, nullptr, 0);
109
- HGLOBAL hGlob = GlobalAlloc(GMEM_MOVEABLE, size * sizeof(wchar_t));
110
- if (hGlob) {
111
- wchar_t *pGlob = static_cast<wchar_t *>(GlobalLock(hGlob));
112
- MultiByteToWideChar(CP_UTF8, 0, text.c_str(), -1, pGlob, size);
113
- GlobalUnlock(hGlob);
114
- SetClipboardData(CF_UNICODETEXT, hGlob);
115
- }
116
-
117
- CloseClipboard();
118
-
119
- #elif defined(__APPLE__)
120
- @autoreleasepool {
121
- NSPasteboard *pasteboard = [NSPasteboard generalPasteboard];
122
- [pasteboard clearContents];
123
- NSString *str = [NSString stringWithUTF8String:text.c_str()];
124
- [pasteboard setString:str forType:NSPasteboardTypeString];
125
- }
126
-
127
- #else
128
- // Linux/GTK implementation
129
- if (!gtk_init_check(nullptr, nullptr)) {
130
- return;
131
- }
132
-
133
- GtkClipboard *clipboard = gtk_clipboard_get(GDK_SELECTION_CLIPBOARD);
134
- gtk_clipboard_set_text(clipboard, text.c_str(), -1);
135
- #endif
136
-
137
- // Trigger change callback
138
- if (pImpl->changeCallback) {
139
- pImpl->changeCallback(text);
140
- }
141
- }
142
-
143
- bool Clipboard::hasText() {
144
- #ifdef _WIN32
145
- return IsClipboardFormatAvailable(CF_UNICODETEXT) != 0;
146
-
147
- #elif defined(__APPLE__)
148
- @autoreleasepool {
149
- NSPasteboard *pasteboard = [NSPasteboard generalPasteboard];
150
- return
151
- [pasteboard availableTypeFromArray:@[ NSPasteboardTypeString ]] != nil;
152
- }
153
-
154
- #else
155
- // Linux/GTK implementation
156
- if (!gtk_init_check(nullptr, nullptr)) {
157
- return false;
158
- }
159
-
160
- GtkClipboard *clipboard = gtk_clipboard_get(GDK_SELECTION_CLIPBOARD);
161
- return gtk_clipboard_wait_is_text_available(clipboard);
162
- #endif
163
- }
164
-
165
- std::string Clipboard::getImage() {
166
- // Image support would require base64 encoding/decoding
167
- // Platform-specific image clipboard handling
168
- // This is a placeholder for now
169
- return "";
170
- }
171
-
172
- void Clipboard::setImage(const std::string &base64Data) {
173
- (void)base64Data; // Suppress unused warning - placeholder implementation
174
- // Image support would require base64 decoding
175
- // Platform-specific image clipboard handling
176
- // This is a placeholder for now
177
- }
178
-
179
- bool Clipboard::hasImage() {
180
- #ifdef _WIN32
181
- return IsClipboardFormatAvailable(CF_DIB) != 0 ||
182
- IsClipboardFormatAvailable(CF_BITMAP) != 0;
183
-
184
- #elif defined(__APPLE__)
185
- @autoreleasepool {
186
- NSPasteboard *pasteboard = [NSPasteboard generalPasteboard];
187
- return [pasteboard availableTypeFromArray:@[
188
- NSPasteboardTypePNG, NSPasteboardTypeTIFF
189
- ]] != nil;
190
- }
191
-
192
- #else
193
- // Linux/GTK implementation
194
- if (!gtk_init_check(nullptr, nullptr)) {
195
- return false;
196
- }
197
-
198
- GtkClipboard *clipboard = gtk_clipboard_get(GDK_SELECTION_CLIPBOARD);
199
- return gtk_clipboard_wait_is_image_available(clipboard);
200
- #endif
201
- }
202
-
203
- void Clipboard::clear() {
204
- std::lock_guard<std::mutex> lock(pImpl->mtx);
205
-
206
- #ifdef _WIN32
207
- if (OpenClipboard(nullptr)) {
208
- EmptyClipboard();
209
- CloseClipboard();
210
- }
211
-
212
- #elif defined(__APPLE__)
213
- @autoreleasepool {
214
- NSPasteboard *pasteboard = [NSPasteboard generalPasteboard];
215
- [pasteboard clearContents];
216
- }
217
-
218
- #else
219
- // Linux/GTK implementation
220
- if (!gtk_init_check(nullptr, nullptr)) {
221
- return;
222
- }
223
-
224
- GtkClipboard *clipboard = gtk_clipboard_get(GDK_SELECTION_CLIPBOARD);
225
- gtk_clipboard_clear(clipboard);
226
- #endif
227
- }
228
-
229
- void Clipboard::onClipboardChange(
230
- std::function<void(const std::string &)> callback) {
231
- std::lock_guard<std::mutex> lock(pImpl->mtx);
232
- pImpl->changeCallback = callback;
233
- }
234
-
235
- } // namespace PlusUI
1
+ #include <memory>
2
+ #include <mutex>
3
+ #include <plusui/clipboard.hpp>
4
+
5
+ #ifdef _WIN32
6
+ #define WIN32_LEAN_AND_MEAN
7
+ #include <windows.h>
8
+ #elif defined(__APPLE__)
9
+ #include <AppKit/AppKit.h>
10
+ #include <CoreFoundation/CoreFoundation.h>
11
+ #else
12
+ // Linux/GTK - would use GTK clipboard APIs
13
+ #include <gtk/gtk.h>
14
+ #endif
15
+
16
+ namespace PlusUI {
17
+
18
+ struct Clipboard::Impl {
19
+ std::mutex mtx;
20
+ std::function<void(const std::string &)> changeCallback;
21
+
22
+ #ifdef _WIN32
23
+ HWND hwnd = nullptr;
24
+ #endif
25
+ };
26
+
27
+ Clipboard::Clipboard() : pImpl(new Impl()) {
28
+ #ifdef _WIN32
29
+ // Create hidden window for clipboard monitoring
30
+ // This would be done properly in a full implementation
31
+ #endif
32
+ }
33
+
34
+ Clipboard::~Clipboard() { delete pImpl; }
35
+
36
+ std::string Clipboard::getText() {
37
+ std::lock_guard<std::mutex> lock(pImpl->mtx);
38
+
39
+ #ifdef _WIN32
40
+ if (!OpenClipboard(nullptr)) {
41
+ return "";
42
+ }
43
+
44
+ HANDLE hData = GetClipboardData(CF_UNICODETEXT);
45
+ if (hData == nullptr) {
46
+ CloseClipboard();
47
+ return "";
48
+ }
49
+
50
+ wchar_t *pszText = static_cast<wchar_t *>(GlobalLock(hData));
51
+ if (pszText == nullptr) {
52
+ CloseClipboard();
53
+ return "";
54
+ }
55
+
56
+ // Convert wide string to UTF-8
57
+ int size = WideCharToMultiByte(CP_UTF8, 0, pszText, -1, nullptr, 0, nullptr,
58
+ nullptr);
59
+ std::string text(size - 1, '\0');
60
+ WideCharToMultiByte(CP_UTF8, 0, pszText, -1, &text[0], size, nullptr,
61
+ nullptr);
62
+
63
+ GlobalUnlock(hData);
64
+ CloseClipboard();
65
+
66
+ return text;
67
+
68
+ #elif defined(__APPLE__)
69
+ @autoreleasepool {
70
+ NSPasteboard *pasteboard = [NSPasteboard generalPasteboard];
71
+ NSString *str = [pasteboard stringForType:NSPasteboardTypeString];
72
+ if (str) {
73
+ return std::string([str UTF8String]);
74
+ }
75
+ return "";
76
+ }
77
+
78
+ #else
79
+ // Linux/GTK implementation
80
+ if (!gtk_init_check(nullptr, nullptr)) {
81
+ return "";
82
+ }
83
+
84
+ GtkClipboard *clipboard = gtk_clipboard_get(GDK_SELECTION_CLIPBOARD);
85
+ gchar *text = gtk_clipboard_wait_for_text(clipboard);
86
+
87
+ std::string result;
88
+ if (text) {
89
+ result = text;
90
+ g_free(text);
91
+ }
92
+
93
+ return result;
94
+ #endif
95
+ }
96
+
97
+ void Clipboard::setText(const std::string &text) {
98
+ std::lock_guard<std::mutex> lock(pImpl->mtx);
99
+
100
+ #ifdef _WIN32
101
+ if (!OpenClipboard(nullptr)) {
102
+ return;
103
+ }
104
+
105
+ EmptyClipboard();
106
+
107
+ // Convert UTF-8 to wide string
108
+ int size = MultiByteToWideChar(CP_UTF8, 0, text.c_str(), -1, nullptr, 0);
109
+ HGLOBAL hGlob = GlobalAlloc(GMEM_MOVEABLE, size * sizeof(wchar_t));
110
+ if (hGlob) {
111
+ wchar_t *pGlob = static_cast<wchar_t *>(GlobalLock(hGlob));
112
+ MultiByteToWideChar(CP_UTF8, 0, text.c_str(), -1, pGlob, size);
113
+ GlobalUnlock(hGlob);
114
+ SetClipboardData(CF_UNICODETEXT, hGlob);
115
+ }
116
+
117
+ CloseClipboard();
118
+
119
+ #elif defined(__APPLE__)
120
+ @autoreleasepool {
121
+ NSPasteboard *pasteboard = [NSPasteboard generalPasteboard];
122
+ [pasteboard clearContents];
123
+ NSString *str = [NSString stringWithUTF8String:text.c_str()];
124
+ [pasteboard setString:str forType:NSPasteboardTypeString];
125
+ }
126
+
127
+ #else
128
+ // Linux/GTK implementation
129
+ if (!gtk_init_check(nullptr, nullptr)) {
130
+ return;
131
+ }
132
+
133
+ GtkClipboard *clipboard = gtk_clipboard_get(GDK_SELECTION_CLIPBOARD);
134
+ gtk_clipboard_set_text(clipboard, text.c_str(), -1);
135
+ #endif
136
+
137
+ // Trigger change callback
138
+ if (pImpl->changeCallback) {
139
+ pImpl->changeCallback(text);
140
+ }
141
+ }
142
+
143
+ bool Clipboard::hasText() {
144
+ #ifdef _WIN32
145
+ return IsClipboardFormatAvailable(CF_UNICODETEXT) != 0;
146
+
147
+ #elif defined(__APPLE__)
148
+ @autoreleasepool {
149
+ NSPasteboard *pasteboard = [NSPasteboard generalPasteboard];
150
+ return
151
+ [pasteboard availableTypeFromArray:@[ NSPasteboardTypeString ]] != nil;
152
+ }
153
+
154
+ #else
155
+ // Linux/GTK implementation
156
+ if (!gtk_init_check(nullptr, nullptr)) {
157
+ return false;
158
+ }
159
+
160
+ GtkClipboard *clipboard = gtk_clipboard_get(GDK_SELECTION_CLIPBOARD);
161
+ return gtk_clipboard_wait_is_text_available(clipboard);
162
+ #endif
163
+ }
164
+
165
+ std::string Clipboard::getImage() {
166
+ // Image support would require base64 encoding/decoding
167
+ // Platform-specific image clipboard handling
168
+ // This is a placeholder for now
169
+ return "";
170
+ }
171
+
172
+ void Clipboard::setImage(const std::string &base64Data) {
173
+ (void)base64Data; // Suppress unused warning - placeholder implementation
174
+ // Image support would require base64 decoding
175
+ // Platform-specific image clipboard handling
176
+ // This is a placeholder for now
177
+ }
178
+
179
+ bool Clipboard::hasImage() {
180
+ #ifdef _WIN32
181
+ return IsClipboardFormatAvailable(CF_DIB) != 0 ||
182
+ IsClipboardFormatAvailable(CF_BITMAP) != 0;
183
+
184
+ #elif defined(__APPLE__)
185
+ @autoreleasepool {
186
+ NSPasteboard *pasteboard = [NSPasteboard generalPasteboard];
187
+ return [pasteboard availableTypeFromArray:@[
188
+ NSPasteboardTypePNG, NSPasteboardTypeTIFF
189
+ ]] != nil;
190
+ }
191
+
192
+ #else
193
+ // Linux/GTK implementation
194
+ if (!gtk_init_check(nullptr, nullptr)) {
195
+ return false;
196
+ }
197
+
198
+ GtkClipboard *clipboard = gtk_clipboard_get(GDK_SELECTION_CLIPBOARD);
199
+ return gtk_clipboard_wait_is_image_available(clipboard);
200
+ #endif
201
+ }
202
+
203
+ void Clipboard::clear() {
204
+ std::lock_guard<std::mutex> lock(pImpl->mtx);
205
+
206
+ #ifdef _WIN32
207
+ if (OpenClipboard(nullptr)) {
208
+ EmptyClipboard();
209
+ CloseClipboard();
210
+ }
211
+
212
+ #elif defined(__APPLE__)
213
+ @autoreleasepool {
214
+ NSPasteboard *pasteboard = [NSPasteboard generalPasteboard];
215
+ [pasteboard clearContents];
216
+ }
217
+
218
+ #else
219
+ // Linux/GTK implementation
220
+ if (!gtk_init_check(nullptr, nullptr)) {
221
+ return;
222
+ }
223
+
224
+ GtkClipboard *clipboard = gtk_clipboard_get(GDK_SELECTION_CLIPBOARD);
225
+ gtk_clipboard_clear(clipboard);
226
+ #endif
227
+ }
228
+
229
+ void Clipboard::onClipboardChange(
230
+ std::function<void(const std::string &)> callback) {
231
+ std::lock_guard<std::mutex> lock(pImpl->mtx);
232
+ pImpl->changeCallback = callback;
233
+ }
234
+
235
+ } // namespace PlusUI