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,3 +1,3 @@
1
- #pragma once
2
-
3
- #include <plusui/connect.hpp>
1
+ #pragma once
2
+
3
+ #include <plusui/connect.hpp>
@@ -1,90 +1,90 @@
1
- #ifndef PLUSUI_DISPLAY_H
2
- #define PLUSUI_DISPLAY_H
3
-
4
- #include <string>
5
- #include <vector>
6
- #include <memory>
7
- #include <functional>
8
-
9
- namespace plusui {
10
-
11
- struct DisplayMode {
12
- int width = 0;
13
- int height = 0;
14
- int refreshRate = 60;
15
- int bitDepth = 32;
16
- };
17
-
18
- struct DisplayBounds {
19
- int x = 0;
20
- int y = 0;
21
- int width = 0;
22
- int height = 0;
23
- };
24
-
25
- struct DisplayResolution {
26
- int width = 0;
27
- int height = 0;
28
- };
29
-
30
- struct Display {
31
- int id = 0;
32
- std::string name;
33
- bool isPrimary = false;
34
- DisplayBounds bounds;
35
- DisplayBounds workArea;
36
- DisplayResolution resolution;
37
- DisplayMode currentMode;
38
- double scaleFactor = 1.0;
39
- double rotation = 0.0;
40
- bool isInternal = false;
41
- bool isConnected = true;
42
- };
43
-
44
- class DisplayManager {
45
- public:
46
- DisplayManager();
47
- ~DisplayManager();
48
-
49
- static DisplayManager& instance();
50
-
51
- std::vector<Display> getAllDisplays();
52
- Display getPrimaryDisplay();
53
- Display getDisplayAt(int x, int y);
54
- Display getDisplayAtCursor();
55
- Display getDisplayById(int id);
56
-
57
- void onDisplayConnected(std::function<void(const Display&)> callback);
58
- void onDisplayDisconnected(std::function<void(int displayId)> callback);
59
- void onDisplayChanged(std::function<void(const Display&)> callback);
60
-
61
- void refresh();
62
-
63
- bool setDisplayMode(int displayId, const DisplayMode& mode);
64
- bool setPosition(int displayId, int x, int y);
65
- bool turnOff(int displayId);
66
-
67
- private:
68
- struct Impl;
69
- std::unique_ptr<Impl> pImpl;
70
- };
71
-
72
- class Screen {
73
- public:
74
- static int getWidth();
75
- static int getHeight();
76
- static int getWidthMM();
77
- static int getHeightMM();
78
-
79
- static double getScaleFactor();
80
- static double getRefreshRate();
81
-
82
- static bool isMain();
83
- static bool isMulti();
84
-
85
- static std::string getName();
86
- };
87
-
88
- }
89
-
90
- #endif
1
+ #ifndef PLUSUI_DISPLAY_H
2
+ #define PLUSUI_DISPLAY_H
3
+
4
+ #include <string>
5
+ #include <vector>
6
+ #include <memory>
7
+ #include <functional>
8
+
9
+ namespace plusui {
10
+
11
+ struct DisplayMode {
12
+ int width = 0;
13
+ int height = 0;
14
+ int refreshRate = 60;
15
+ int bitDepth = 32;
16
+ };
17
+
18
+ struct DisplayBounds {
19
+ int x = 0;
20
+ int y = 0;
21
+ int width = 0;
22
+ int height = 0;
23
+ };
24
+
25
+ struct DisplayResolution {
26
+ int width = 0;
27
+ int height = 0;
28
+ };
29
+
30
+ struct Display {
31
+ int id = 0;
32
+ std::string name;
33
+ bool isPrimary = false;
34
+ DisplayBounds bounds;
35
+ DisplayBounds workArea;
36
+ DisplayResolution resolution;
37
+ DisplayMode currentMode;
38
+ double scaleFactor = 1.0;
39
+ double rotation = 0.0;
40
+ bool isInternal = false;
41
+ bool isConnected = true;
42
+ };
43
+
44
+ class DisplayManager {
45
+ public:
46
+ DisplayManager();
47
+ ~DisplayManager();
48
+
49
+ static DisplayManager& instance();
50
+
51
+ std::vector<Display> getAllDisplays();
52
+ Display getPrimaryDisplay();
53
+ Display getDisplayAt(int x, int y);
54
+ Display getDisplayAtCursor();
55
+ Display getDisplayById(int id);
56
+
57
+ void onDisplayConnected(std::function<void(const Display&)> callback);
58
+ void onDisplayDisconnected(std::function<void(int displayId)> callback);
59
+ void onDisplayChanged(std::function<void(const Display&)> callback);
60
+
61
+ void refresh();
62
+
63
+ bool setDisplayMode(int displayId, const DisplayMode& mode);
64
+ bool setPosition(int displayId, int x, int y);
65
+ bool turnOff(int displayId);
66
+
67
+ private:
68
+ struct Impl;
69
+ std::unique_ptr<Impl> pImpl;
70
+ };
71
+
72
+ class Screen {
73
+ public:
74
+ static int getWidth();
75
+ static int getHeight();
76
+ static int getWidthMM();
77
+ static int getHeightMM();
78
+
79
+ static double getScaleFactor();
80
+ static double getRefreshRate();
81
+
82
+ static bool isMain();
83
+ static bool isMulti();
84
+
85
+ static std::string getName();
86
+ };
87
+
88
+ }
89
+
90
+ #endif
@@ -1,77 +1,92 @@
1
- #pragma once
2
-
3
- #include <string>
4
- #include <vector>
5
- #include <functional>
6
-
7
- namespace PlusUI {
8
-
9
- /**
10
- * FileInfo - Represents a dropped file
11
- */
12
- struct FileInfo {
13
- std::string path; // Full path to the file
14
- std::string name; // File name with extension
15
- std::string type; // MIME type (e.g., "image/png", "text/plain")
16
- std::uint64_t size; // File size in bytes
17
- };
18
-
19
- /**
20
- * FileDrop - Cross-platform drag & drop file handling
21
- *
22
- * Enables dragging files into the webview window and from the window to the desktop.
23
- * Supports all file types cross-platform (Windows, macOS, Linux).
24
- */
25
- class FileDrop {
26
- public:
27
- FileDrop();
28
- ~FileDrop();
29
-
30
- /**
31
- * Enable or disable file drop into window
32
- * @param enabled - true to allow files to be dropped into the window
33
- */
34
- void setEnabled(bool enabled);
35
-
36
- /**
37
- * Check if file drop is currently enabled
38
- * @return true if file drop is enabled
39
- */
40
- bool isEnabled() const;
41
-
42
- /**
43
- * Set callback for when files are dropped into the window
44
- * @param callback - Function called with array of dropped files
45
- */
46
- void onFilesDropped(std::function<void(const std::vector<FileInfo>&)> callback);
47
-
48
- /**
49
- * Set callback for when a drag operation enters the window
50
- * @param callback - Function called when drag enters
51
- */
52
- void onDragEnter(std::function<void()> callback);
53
-
54
- /**
55
- * Set callback for when a drag operation leaves the window
56
- * @param callback - Function called when drag leaves
57
- */
58
- void onDragLeave(std::function<void()> callback);
59
-
60
- /**
61
- * Start a drag operation to drag files out of the window
62
- * @param filePaths - Paths to files to be dragged
63
- * @return true if drag operation started successfully
64
- */
65
- bool startDrag(const std::vector<std::string>& filePaths);
66
-
67
- /**
68
- * Clear all callbacks
69
- */
70
- void clearCallbacks();
71
-
72
- private:
73
- struct Impl;
74
- Impl* pImpl;
75
- };
76
-
77
- } // namespace PlusUI
1
+ #pragma once
2
+
3
+ #include <cstdint>
4
+ #include <string>
5
+ #include <vector>
6
+ #include <functional>
7
+
8
+ namespace plusui {
9
+ class Window;
10
+ }
11
+
12
+ namespace plusui {
13
+
14
+ /**
15
+ * FileInfo - Represents a dropped file
16
+ */
17
+ struct FileInfo {
18
+ std::string path; // Full path to the file
19
+ std::string name; // File name with extension
20
+ std::string type; // MIME type (e.g., "image/png", "text/plain")
21
+ std::uint64_t size; // File size in bytes
22
+ };
23
+
24
+ /**
25
+ * FileDrop - Cross-platform drag & drop file handling
26
+ *
27
+ * Enables dragging files into the webview window and from the window to the desktop.
28
+ * Supports all file types cross-platform (Windows, macOS, Linux).
29
+ */
30
+ class FileDrop {
31
+ public:
32
+ FileDrop();
33
+ ~FileDrop();
34
+
35
+ static FileDrop& instance() {
36
+ static FileDrop instance;
37
+ return instance;
38
+ }
39
+
40
+ /**
41
+ * Attach FileDrop handlers to a Window
42
+ */
43
+ void attach(void* nativeWindowHandle, void* nativeWebViewHandle);
44
+
45
+ /**
46
+ * Enable or disable file drop into window
47
+ * @param enabled - true to allow files to be dropped into the window
48
+ */
49
+ void setEnabled(bool enabled);
50
+
51
+ /**
52
+ * Check if file drop is currently enabled
53
+ * @return true if file drop is enabled
54
+ */
55
+ bool isEnabled() const;
56
+
57
+ /**
58
+ * Set callback for when files are dropped into the window
59
+ * @param callback - Function called with array of dropped files
60
+ */
61
+ void onFilesDropped(std::function<void(const std::vector<FileInfo>&)> callback);
62
+
63
+ /**
64
+ * Set callback for when a drag operation enters the window
65
+ * @param callback - Function called when drag enters
66
+ */
67
+ void onDragEnter(std::function<void()> callback);
68
+
69
+ /**
70
+ * Set callback for when a drag operation leaves the window
71
+ * @param callback - Function called when drag leaves
72
+ */
73
+ void onDragLeave(std::function<void()> callback);
74
+
75
+ /**
76
+ * Start a drag operation to drag files out of the window
77
+ * @param filePaths - Paths to files to be dragged
78
+ * @return true if drag operation started successfully
79
+ */
80
+ bool startDrag(const std::vector<std::string>& filePaths);
81
+
82
+ /**
83
+ * Clear all callbacks
84
+ */
85
+ void clearCallbacks();
86
+
87
+ private:
88
+ struct Impl;
89
+ Impl* pImpl;
90
+ };
91
+
92
+ } // namespace plusui
@@ -1,112 +1,112 @@
1
- #ifndef PLUSUI_KEYBOARD_H
2
- #define PLUSUI_KEYBOARD_H
3
-
4
- #include <string>
5
- #include <vector>
6
- #include <functional>
7
- #include <map>
8
- #include <memory>
9
-
10
- namespace plusui {
11
-
12
- enum class KeyCode {
13
- Unknown = 0,
14
- Space = 32, Apostrophe = 39, Comma = 44, Minus = 45, Period = 46,
15
- Slash = 47, Num0 = 48, Num1 = 49, Num2 = 50, Num3 = 51, Num4 = 52,
16
- Num5 = 53, Num6 = 54, Num7 = 55, Num8 = 56, Num9 = 57,
17
- Semicolon = 59, Equal = 61, A = 65, B = 66, C = 67, D = 68, E = 69,
18
- F = 70, G = 71, H = 72, I = 73, J = 74, K = 75, L = 76, M = 77,
19
- N = 78, O = 79, P = 80, Q = 81, R = 82, S = 83, T = 84, U = 85,
20
- V = 86, W = 87, X = 88, Y = 89, Z = 90, LeftBracket = 91,
21
- Backslash = 92, RightBracket = 93, GraveAccent = 96,
22
- Escape = 256, Enter = 257, Tab = 258, Backspace = 259,
23
- Insert = 260, Delete = 261, Right = 262, Left = 263, Down = 264,
24
- Up = 265, PageUp = 266, PageDown = 267, Home = 268, End = 269,
25
- CapsLock = 280, F1 = 290, F2 = 291, F3 = 292, F4 = 293, F5 = 294,
26
- F6 = 295, F7 = 296, F8 = 297, F9 = 298, F10 = 299, F11 = 300,
27
- F12 = 301, LeftShift = 340, LeftControl = 341, LeftAlt = 342,
28
- LeftSuper = 343, RightShift = 344, RightControl = 345,
29
- RightAlt = 346, RightSuper = 347
30
- };
31
-
32
- enum class KeyMod {
33
- None = 0, Shift = 1, Control = 2, Alt = 4, Super = 8
34
- };
35
-
36
- inline KeyMod operator|(KeyMod a, KeyMod b) {
37
- return static_cast<KeyMod>(static_cast<int>(a) | static_cast<int>(b));
38
- }
39
-
40
- inline bool operator&(KeyMod a, KeyMod b) {
41
- return (static_cast<int>(a) & static_cast<int>(b)) != 0;
42
- }
43
-
44
- struct KeyEvent {
45
- KeyCode key = KeyCode::Unknown;
46
- int scancode = 0;
47
- KeyMod mods = KeyMod::None;
48
- bool pressed = false;
49
- bool repeat = false;
50
- std::string keyName;
51
- };
52
-
53
- struct Shortcut {
54
- KeyCode key = KeyCode::Unknown;
55
- KeyMod mods = KeyMod::None;
56
-
57
- Shortcut() = default;
58
- Shortcut(KeyCode k, KeyMod m = KeyMod::None) : key(k), mods(m) {}
59
-
60
- std::string toString() const;
61
- static Shortcut parse(const std::string& str);
62
- };
63
-
64
- class Keyboard {
65
- public:
66
- Keyboard();
67
- ~Keyboard();
68
-
69
- static Keyboard& instance();
70
-
71
- void onKeyDown(std::function<void(const KeyEvent&)> callback);
72
- void onKeyUp(std::function<void(const KeyEvent&)> callback);
73
-
74
- bool isKeyPressed(KeyCode key) const;
75
- bool areModsActive(KeyMod mods) const;
76
-
77
- std::string getKeyName(KeyCode key) const;
78
- KeyCode getKeyFromName(const std::string& name) const;
79
-
80
- void setAutoRepeat(bool enabled);
81
- bool getAutoRepeat() const;
82
-
83
- private:
84
- struct Impl;
85
- std::unique_ptr<Impl> pImpl;
86
- };
87
-
88
- class ShortcutManager {
89
- public:
90
- ShortcutManager();
91
- ~ShortcutManager();
92
-
93
- static ShortcutManager& instance();
94
-
95
- bool registerShortcut(const std::string& id, const Shortcut& shortcut,
96
- std::function<void()> callback);
97
- bool unregisterShortcut(const std::string& id);
98
- void clearShortcuts();
99
-
100
- bool isRegistered(const std::string& id) const;
101
- Shortcut getShortcut(const std::string& id) const;
102
-
103
- void onShortcutTriggered(std::function<void(const std::string& id)> callback);
104
-
105
- private:
106
- struct Impl;
107
- std::unique_ptr<Impl> pImpl;
108
- };
109
-
110
- }
111
-
112
- #endif
1
+ #ifndef PLUSUI_KEYBOARD_H
2
+ #define PLUSUI_KEYBOARD_H
3
+
4
+ #include <string>
5
+ #include <vector>
6
+ #include <functional>
7
+ #include <map>
8
+ #include <memory>
9
+
10
+ namespace plusui {
11
+
12
+ enum class KeyCode {
13
+ Unknown = 0,
14
+ Space = 32, Apostrophe = 39, Comma = 44, Minus = 45, Period = 46,
15
+ Slash = 47, Num0 = 48, Num1 = 49, Num2 = 50, Num3 = 51, Num4 = 52,
16
+ Num5 = 53, Num6 = 54, Num7 = 55, Num8 = 56, Num9 = 57,
17
+ Semicolon = 59, Equal = 61, A = 65, B = 66, C = 67, D = 68, E = 69,
18
+ F = 70, G = 71, H = 72, I = 73, J = 74, K = 75, L = 76, M = 77,
19
+ N = 78, O = 79, P = 80, Q = 81, R = 82, S = 83, T = 84, U = 85,
20
+ V = 86, W = 87, X = 88, Y = 89, Z = 90, LeftBracket = 91,
21
+ Backslash = 92, RightBracket = 93, GraveAccent = 96,
22
+ Escape = 256, Enter = 257, Tab = 258, Backspace = 259,
23
+ Insert = 260, Delete = 261, Right = 262, Left = 263, Down = 264,
24
+ Up = 265, PageUp = 266, PageDown = 267, Home = 268, End = 269,
25
+ CapsLock = 280, F1 = 290, F2 = 291, F3 = 292, F4 = 293, F5 = 294,
26
+ F6 = 295, F7 = 296, F8 = 297, F9 = 298, F10 = 299, F11 = 300,
27
+ F12 = 301, LeftShift = 340, LeftControl = 341, LeftAlt = 342,
28
+ LeftSuper = 343, RightShift = 344, RightControl = 345,
29
+ RightAlt = 346, RightSuper = 347
30
+ };
31
+
32
+ enum class KeyMod {
33
+ None = 0, Shift = 1, Control = 2, Alt = 4, Super = 8
34
+ };
35
+
36
+ inline KeyMod operator|(KeyMod a, KeyMod b) {
37
+ return static_cast<KeyMod>(static_cast<int>(a) | static_cast<int>(b));
38
+ }
39
+
40
+ inline bool operator&(KeyMod a, KeyMod b) {
41
+ return (static_cast<int>(a) & static_cast<int>(b)) != 0;
42
+ }
43
+
44
+ struct KeyEvent {
45
+ KeyCode key = KeyCode::Unknown;
46
+ int scancode = 0;
47
+ KeyMod mods = KeyMod::None;
48
+ bool pressed = false;
49
+ bool repeat = false;
50
+ std::string keyName;
51
+ };
52
+
53
+ struct Shortcut {
54
+ KeyCode key = KeyCode::Unknown;
55
+ KeyMod mods = KeyMod::None;
56
+
57
+ Shortcut() = default;
58
+ Shortcut(KeyCode k, KeyMod m = KeyMod::None) : key(k), mods(m) {}
59
+
60
+ std::string toString() const;
61
+ static Shortcut parse(const std::string& str);
62
+ };
63
+
64
+ class Keyboard {
65
+ public:
66
+ Keyboard();
67
+ ~Keyboard();
68
+
69
+ static Keyboard& instance();
70
+
71
+ void onKeyDown(std::function<void(const KeyEvent&)> callback);
72
+ void onKeyUp(std::function<void(const KeyEvent&)> callback);
73
+
74
+ bool isKeyPressed(KeyCode key) const;
75
+ bool areModsActive(KeyMod mods) const;
76
+
77
+ std::string getKeyName(KeyCode key) const;
78
+ KeyCode getKeyFromName(const std::string& name) const;
79
+
80
+ void setAutoRepeat(bool enabled);
81
+ bool getAutoRepeat() const;
82
+
83
+ private:
84
+ struct Impl;
85
+ std::unique_ptr<Impl> pImpl;
86
+ };
87
+
88
+ class ShortcutManager {
89
+ public:
90
+ ShortcutManager();
91
+ ~ShortcutManager();
92
+
93
+ static ShortcutManager& instance();
94
+
95
+ bool registerShortcut(const std::string& id, const Shortcut& shortcut,
96
+ std::function<void()> callback);
97
+ bool unregisterShortcut(const std::string& id);
98
+ void clearShortcuts();
99
+
100
+ bool isRegistered(const std::string& id) const;
101
+ Shortcut getShortcut(const std::string& id) const;
102
+
103
+ void onShortcutTriggered(std::function<void(const std::string& id)> callback);
104
+
105
+ private:
106
+ struct Impl;
107
+ std::unique_ptr<Impl> pImpl;
108
+ };
109
+
110
+ }
111
+
112
+ #endif