plusui-native-core 0.1.3 → 0.1.5

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 (54) hide show
  1. package/Core/CMakeLists.txt +190 -7
  2. package/Core/Features/App/app.cpp +129 -0
  3. package/Core/Features/App/app.ts +126 -0
  4. package/Core/Features/Browser/browser.cpp +181 -0
  5. package/Core/Features/Browser/browser.ts +182 -0
  6. package/Core/Features/Clipboard/clipboard.cpp +234 -0
  7. package/Core/Features/Clipboard/clipboard.ts +113 -0
  8. package/Core/Features/Display/display.cpp +209 -0
  9. package/Core/Features/Display/display.ts +104 -0
  10. package/Core/Features/Event/Events.ts +166 -0
  11. package/Core/Features/Event/events.cpp +200 -0
  12. package/Core/Features/Keyboard/keyboard.cpp +186 -0
  13. package/Core/Features/Keyboard/keyboard.ts +175 -0
  14. package/Core/Features/Menu/context-menu.css +293 -0
  15. package/Core/Features/Menu/menu.cpp +481 -0
  16. package/Core/Features/Menu/menu.ts +439 -0
  17. package/Core/Features/Tray/tray.cpp +310 -0
  18. package/Core/Features/Tray/tray.ts +68 -0
  19. package/Core/Features/WebGPU/webgpu.cpp +937 -0
  20. package/Core/Features/WebGPU/webgpu.ts +1013 -0
  21. package/Core/Features/WebView/webview.cpp +1052 -0
  22. package/Core/Features/WebView/webview.ts +510 -0
  23. package/Core/Features/Window/window.cpp +664 -0
  24. package/Core/Features/Window/window.ts +142 -0
  25. package/Core/Features/WindowManager/window_manager.cpp +341 -0
  26. package/Core/include/plusui/app.hpp +73 -0
  27. package/Core/include/plusui/browser.hpp +66 -0
  28. package/Core/include/plusui/clipboard.hpp +41 -0
  29. package/Core/include/plusui/events.hpp +58 -0
  30. package/Core/include/{keyboard.hpp → plusui/keyboard.hpp} +21 -44
  31. package/Core/include/plusui/menu.hpp +153 -0
  32. package/Core/include/plusui/tray.hpp +93 -0
  33. package/Core/include/plusui/webgpu.hpp +434 -0
  34. package/Core/include/plusui/webview.hpp +142 -0
  35. package/Core/include/plusui/window.hpp +111 -0
  36. package/Core/include/plusui/window_manager.hpp +57 -0
  37. package/Core/vendor/WebView2EnvironmentOptions.h +406 -0
  38. package/Core/vendor/stb_image.h +7988 -0
  39. package/Core/vendor/webview.h +618 -510
  40. package/Core/vendor/webview2.h +52079 -0
  41. package/README.md +19 -0
  42. package/package.json +12 -15
  43. package/Core/include/app.hpp +0 -121
  44. package/Core/include/menu.hpp +0 -79
  45. package/Core/include/tray.hpp +0 -81
  46. package/Core/include/window.hpp +0 -106
  47. package/Core/src/app.cpp +0 -311
  48. package/Core/src/display.cpp +0 -424
  49. package/Core/src/tray.cpp +0 -275
  50. package/Core/src/window.cpp +0 -528
  51. package/dist/index.d.ts +0 -205
  52. package/dist/index.js +0 -198
  53. package/src/index.ts +0 -574
  54. /package/Core/include/{display.hpp → plusui/display.hpp} +0 -0
package/README.md ADDED
@@ -0,0 +1,19 @@
1
+ # plusui-native-core
2
+
3
+ PlusUI Core framework package containing the actual `Core/` implementation used by generated apps.
4
+
5
+ This package ships:
6
+ - `Core/CMakeLists.txt`
7
+ - `Core/include/plusui/*`
8
+ - `Core/Features/*`
9
+ - `Core/vendor/*`
10
+
11
+ Generated apps resolve this package from:
12
+ - `node_modules/plusui-native-core`
13
+ - `node_modules/plusui-native-core/Core` (legacy fallback)
14
+
15
+ Install:
16
+
17
+ ```bash
18
+ npm i plusui-native-core
19
+ ```
package/package.json CHANGED
@@ -1,28 +1,25 @@
1
1
  {
2
2
  "name": "plusui-native-core",
3
- "version": "0.1.3",
4
- "description": "PlusUI TypeScript SDK for C++ desktop apps",
5
- "main": "dist/index.js",
6
- "types": "dist/index.d.ts",
3
+ "version": "0.1.5",
4
+ "description": "PlusUI Core framework (frontend + backend feature implementations)",
7
5
  "type": "module",
8
6
  "files": [
9
- "Core/CMakeLists.txt",
10
- "Core/README.md",
11
- "Core/include",
12
- "Core/src",
13
- "Core/vendor",
14
- "dist",
15
- "src"
7
+ "Core",
8
+ "README.md"
16
9
  ],
17
10
  "scripts": {
18
- "build": "tsc",
19
- "watch": "tsc --watch"
11
+ "prepack": "node scripts/sync-core.mjs"
20
12
  },
21
13
  "keywords": [
22
14
  "desktop",
23
15
  "cpp",
24
16
  "webview",
25
- "gui"
17
+ "gui",
18
+ "framework",
19
+ "core"
26
20
  ],
27
- "license": "MIT"
21
+ "license": "MIT",
22
+ "publishConfig": {
23
+ "access": "public"
24
+ }
28
25
  }
@@ -1,121 +0,0 @@
1
- #ifndef PLUSUI_APP_H
2
- #define PLUSUI_APP_H
3
-
4
- #include <string>
5
- #include <memory>
6
- #include <functional>
7
- #include <future>
8
- #include "tray.hpp"
9
-
10
- #ifdef _WIN32
11
- #define PLUSUI_EDGE
12
- #elif defined(__APPLE__)
13
- #define PLUSUI_COCOA
14
- #else
15
- #define PLUSUI_GTK
16
- #endif
17
-
18
- namespace plusui {
19
-
20
- class WebView;
21
-
22
- class App {
23
- public:
24
- App();
25
- ~App();
26
-
27
- class Builder;
28
-
29
- void run();
30
- void quit();
31
-
32
- private:
33
- struct Impl;
34
- std::unique_ptr<Impl> pImpl;
35
- };
36
-
37
- class App::Builder {
38
- public:
39
- Builder& title(const std::string& t);
40
- Builder& width(int w);
41
- Builder& height(int h);
42
- Builder& resizable(bool r);
43
- Builder& devtools(bool d);
44
- Builder& trayIcon(const std::string& icon);
45
- Builder& trayTooltip(const std::string& tooltip);
46
- Builder& alwaysOnTop(bool top);
47
- Builder& centered(bool center);
48
- Builder& transparent(bool transparent);
49
- Builder& decorations(bool decorations);
50
- Builder& skipTaskbar(bool skip);
51
-
52
- WebView build();
53
-
54
- private:
55
- struct Config {
56
- std::string title = "PlusUI App";
57
- int width = 800;
58
- int height = 600;
59
- bool resizable = true;
60
- bool devtools = false;
61
- std::string trayIconPath;
62
- std::string trayTooltip;
63
- bool alwaysOnTop = false;
64
- bool centered = true;
65
- bool transparent = false;
66
- bool decorations = true;
67
- bool skipTaskbar = false;
68
- };
69
- Config config;
70
- friend class WebView;
71
- };
72
-
73
- class WebView {
74
- public:
75
- WebView(const App::Builder::Config& config);
76
- ~WebView();
77
-
78
- void navigate(const std::string& url);
79
- void loadHTML(const std::string& html);
80
- void loadFile(const std::string& path);
81
- void eval(const std::string& js);
82
-
83
- template<typename T>
84
- std::future<T> evaluate(const std::string& js);
85
-
86
- template<typename F>
87
- void expose(const std::string& name, F&& callback);
88
-
89
- void on(const std::string& event, std::function<void(const std::string&)> callback);
90
- void emit(const std::string& event, const std::string& data = "");
91
-
92
- void* nativeWindow();
93
-
94
- TrayManager& tray();
95
- WindowManager& window();
96
-
97
- private:
98
- struct Impl;
99
- std::unique_ptr<Impl> pImpl;
100
- };
101
-
102
- template<typename T>
103
- std::future<T> WebView::evaluate(const std::string& js) {
104
- std::promise<T> p;
105
- p.set_value(T());
106
- return p.get_future();
107
- }
108
-
109
- template<typename F>
110
- void WebView::expose(const std::string& name, F&& callback) {
111
- (void)name;
112
- (void)callback;
113
- }
114
-
115
- App::Builder createApp();
116
-
117
- }
118
-
119
- #define PLUSUI_MAIN int main(int argc, char* argv[])
120
-
121
- #endif
@@ -1,79 +0,0 @@
1
- #ifndef PLUSUI_MENU_H
2
- #define PLUSUI_MENU_H
3
-
4
- #include <string>
5
- #include <vector>
6
- #include <memory>
7
- #include <functional>
8
-
9
- namespace plusui {
10
-
11
- enum class MenuItemType {
12
- Normal,
13
- Separator,
14
- Submenu,
15
- Checkbox,
16
- Radio
17
- };
18
-
19
- struct MenuItem {
20
- std::string id;
21
- std::string label;
22
- std::string accelerator;
23
- std::string icon;
24
- MenuItemType type = MenuItemType::Normal;
25
- bool enabled = true;
26
- bool checked = false;
27
- std::vector<MenuItem> submenu;
28
- };
29
-
30
- struct MenuBar {
31
- std::vector<MenuItem> items;
32
- };
33
-
34
- class Menu {
35
- public:
36
- Menu();
37
- ~Menu();
38
-
39
- static Menu create(const std::vector<MenuItem>& items = {});
40
-
41
- void setItems(const std::vector<MenuItem>& items);
42
- std::vector<MenuItem> getItems() const;
43
-
44
- void append(const MenuItem& item);
45
- void insert(int index, const MenuItem& item);
46
- void remove(const std::string& id);
47
- void clear();
48
-
49
- void popup(int x, int y);
50
- void close();
51
-
52
- private:
53
- struct Impl;
54
- std::unique_ptr<Impl> pImpl;
55
- };
56
-
57
- class MenuBar {
58
- public:
59
- MenuBar();
60
- ~MenuBar();
61
-
62
- static MenuBar& instance();
63
-
64
- void setMenu(const ::plusui::MenuBar& menu);
65
- ::plusui::MenuBar getMenu() const;
66
-
67
- void append(const MenuItem& item);
68
- void insert(int index, const MenuItem& item);
69
- void remove(const std::string& id);
70
- void clear();
71
-
72
- void onMenuItemClick(std::function<void(const std::string& id)> callback);
73
-
74
- private:
75
- struct Impl;
76
- std::unique_ptr<Impl> pImpl;
77
- };
78
-
79
- }
@@ -1,81 +0,0 @@
1
- #ifndef PLUSUI_TRAY_H
2
- #define PLUSUI_TRAY_H
3
-
4
- #include <string>
5
- #include <vector>
6
- #include <memory>
7
- #include <functional>
8
-
9
- namespace plusui {
10
-
11
- struct TrayMenuItem {
12
- std::string id;
13
- std::string label;
14
- std::string icon;
15
- bool enabled = true;
16
- bool checked = false;
17
- bool separator = false;
18
- std::vector<TrayMenuItem> submenu;
19
- };
20
-
21
- struct TrayIconData {
22
- int id = 0;
23
- std::string tooltip;
24
- std::string iconPath;
25
- bool isVisible = true;
26
- };
27
-
28
- class TrayIcon {
29
- public:
30
- TrayIcon();
31
- ~TrayIcon();
32
-
33
- static TrayIcon create(const std::string& tooltip = "", const std::string& iconPath = "");
34
-
35
- void setTooltip(const std::string& tooltip);
36
- void setIcon(const std::string& iconPath);
37
- void setIconFromData(const std::vector<uint8_t>& data, int width = 16, int height = 16);
38
-
39
- void show();
40
- void hide();
41
- bool isVisible() const;
42
-
43
- void setMenu(const std::vector<TrayMenuItem>& items);
44
- void setContextMenu(const std::vector<TrayMenuItem>& items);
45
-
46
- void onClick(std::function<void(int x, int y)> callback);
47
- void onRightClick(std::function<void(int x, int y)> callback);
48
- void onDoubleClick(std::function<void()> callback);
49
- void onMenuItemClick(std::function<void(const std::string& id)> callback);
50
-
51
- void dispose();
52
-
53
- private:
54
- struct Impl;
55
- std::unique_ptr<Impl> pImpl;
56
- };
57
-
58
- class TrayManager {
59
- public:
60
- static TrayManager& instance();
61
-
62
- std::vector<TrayIcon*> getIcons();
63
-
64
- void onTrayCreated(std::function<void(TrayIcon& icon)> callback);
65
- void onTrayDestroyed(std::function<void(int iconId)> callback);
66
-
67
- void refresh();
68
-
69
- private:
70
- TrayManager() = default;
71
- ~TrayManager() = default;
72
- TrayManager(const TrayManager&) = delete;
73
- TrayManager& operator=(const TrayManager&) = delete;
74
-
75
- struct Impl;
76
- std::unique_ptr<Impl> pImpl;
77
- };
78
-
79
- }
80
-
81
- #endif
@@ -1,106 +0,0 @@
1
- #ifndef PLUSUI_WINDOW_H
2
- #define PLUSUI_WINDOW_H
3
-
4
- #include <string>
5
- #include <functional>
6
- #include <memory>
7
-
8
- namespace plusui {
9
-
10
- struct WindowConfig {
11
- int x = -1;
12
- int y = -1;
13
- int width = 800;
14
- int height = 600;
15
- int minWidth = 0;
16
- int minHeight = 0;
17
- int maxWidth = 0;
18
- int maxHeight = 0;
19
- std::string title = "PlusUI";
20
- bool resizable = true;
21
- bool fullscreen = false;
22
- bool maximized = false;
23
- bool minimizable = true;
24
- bool closable = true;
25
- bool alwaysOnTop = false;
26
- bool center = true;
27
- };
28
-
29
- struct WindowState {
30
- int x = 0;
31
- int y = 0;
32
- int width = 800;
33
- int height = 600;
34
- bool isFullscreen = false;
35
- bool isMaximized = false;
36
- bool isMinimized = false;
37
- bool isFocused = true;
38
- bool isVisible = true;
39
- };
40
-
41
- class Window {
42
- public:
43
- Window();
44
- ~Window();
45
-
46
- static Window create(const WindowConfig& config = {});
47
-
48
- void setTitle(const std::string& title);
49
- std::string getTitle() const;
50
-
51
- void setSize(int width, int height);
52
- void getSize(int& width, int& height) const;
53
-
54
- void setMinSize(int minWidth, int minHeight);
55
- void setMaxSize(int maxWidth, int maxHeight);
56
-
57
- void setPosition(int x, int y);
58
- void getPosition(int& x, int& y) const;
59
-
60
- void center();
61
- void setFullscreen(bool enabled);
62
- bool isFullscreen() const;
63
-
64
- void minimize();
65
- void maximize();
66
- void restore();
67
- bool isMaximized() const;
68
- bool isMinimized() const;
69
-
70
- void show();
71
- void hide();
72
- bool isVisible() const;
73
-
74
- void focus();
75
- bool isFocused() const;
76
-
77
- void setAlwaysOnTop(bool enabled);
78
- void setResizable(bool enabled);
79
-
80
- void setDecorations(bool enabled);
81
- void setSkipTaskbar(bool enabled);
82
-
83
- WindowState getState() const;
84
-
85
- using MoveCallback = std::function<void(int x, int y)>;
86
- using ResizeCallback = std::function<void(int width, int height)>;
87
- using CloseCallback = std::function<void()>;
88
- using FocusCallback = std::function<void(bool focused)>;
89
- using StateCallback = std::function<void(WindowState state)>;
90
-
91
- void onMove(MoveCallback callback);
92
- void onResize(ResizeCallback callback);
93
- void onClose(CloseCallback callback);
94
- void onFocus(FocusCallback callback);
95
- void onStateChange(StateCallback callback);
96
-
97
- void* nativeHandle() const;
98
-
99
- private:
100
- struct Impl;
101
- std::unique_ptr<Impl> pImpl;
102
- };
103
-
104
- }
105
-
106
- #endif