plusui-native-core 0.1.21 → 0.1.23

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.
@@ -1,142 +1,142 @@
1
- #pragma once
2
-
3
- #include <functional>
4
- #include <future>
5
- #include <map>
6
- #include <memory>
7
- #include <string>
8
- #include <vector>
9
-
10
- namespace plusui {
11
-
12
- class TrayManager;
13
- class WindowManager;
14
- class Window;
15
-
16
- struct WebViewConfig {
17
- std::string userAgent = "";
18
- bool devtools = true;
19
- bool contextMenu = true;
20
- bool javascript = true;
21
- bool webSecurity = true;
22
- bool allowFileAccess = false;
23
- bool allowRemoteContent = true;
24
- std::string dataPath = "";
25
- int cacheSize = 100; // MB
26
- bool scrollbars = true; // Show/hide scrollbars
27
-
28
- // App Builder style config
29
- std::string title;
30
- int width = 800;
31
- int height = 600;
32
- bool resizable = true;
33
- };
34
-
35
- class WebView {
36
- public:
37
- using WindowId = uint64_t;
38
-
39
- // Callback types
40
- using VoidCallback = std::function<void()>;
41
- using StringCallback = std::function<void(const std::string &result)>;
42
- using BoolCallback = std::function<bool(const std::string &url)>;
43
- using ErrorCallback = std::function<void(const std::string &error, int code)>;
44
- using ConsoleCallback = std::function<void(
45
- const std::string &message, int level, const std::string &source)>;
46
- using JSCallback = std::function<std::string(const std::string &args)>;
47
- using NavigationCallback = std::function<bool(const std::string &url)>;
48
- using LoadCallback = std::function<void()>;
49
-
50
- WebView();
51
- // Constructor used by App::Builder
52
- struct AppConfig;
53
- // WebView(const AppConfig& config); // We'll handle this via create or
54
- // similar
55
-
56
- ~WebView();
57
-
58
- // Move only
59
- WebView(WebView &&other) noexcept;
60
- WebView &operator=(WebView &&other) noexcept;
61
- WebView(const WebView &) = delete;
62
- WebView &operator=(const WebView &) = delete;
63
-
64
- static WebView create(void *windowHandle, const WebViewConfig &config = {});
65
-
66
- // Content loading
67
- void loadURL(const std::string &url);
68
- void loadHTML(const std::string &html);
69
- void loadHTML(const std::string &html, const std::string &baseURL);
70
- void loadFile(const std::string &filePath);
71
- void navigate(const std::string &url);
72
-
73
- // Navigation
74
- void reload();
75
- void stop();
76
- void goBack();
77
- void goForward();
78
- bool canGoBack() const;
79
- bool canGoForward() const;
80
-
81
- // Scripting
82
- void executeScript(const std::string &script);
83
- void executeScript(const std::string &script, StringCallback callback);
84
- void eval(const std::string &js) {
85
- executeScript(js);
86
- } // Alias for compatibility
87
-
88
- template <typename T> std::future<T> evaluate(const std::string &js) {
89
- // Implementation in cpp or inline
90
- return std::future<T>();
91
- }
92
-
93
- // Bindings
94
- void bind(const std::string &name, JSCallback callback);
95
- void unbind(const std::string &name);
96
-
97
- template <typename F> void expose(const std::string &name, F &&callback) {
98
- // Implementation for simplified expose
99
- }
100
-
101
- // Dev tools
102
- void openDevTools();
103
- void closeDevTools();
104
-
105
- // Events
106
- void on(const std::string &event,
107
- std::function<void(const std::string &)> callback);
108
- void emit(const std::string &event, const std::string &data = "");
109
-
110
- // Settings
111
- void setUserAgent(const std::string &userAgent);
112
- std::string getUserAgent() const;
113
- void setZoom(double factor);
114
- double getZoom() const;
115
- void injectCSS(const std::string &css);
116
-
117
- // Callbacks
118
- void onNavigationStart(NavigationCallback callback);
119
- void onNavigationComplete(LoadCallback callback);
120
- void onLoadStart(LoadCallback callback);
121
- void onLoadEnd(LoadCallback callback);
122
- void onLoadError(ErrorCallback callback);
123
- void onConsoleMessage(ConsoleCallback callback);
124
-
125
- // State
126
- bool isLoading() const;
127
- std::string getURL() const;
128
- std::string getTitle() const;
129
- void *nativeHandle() const;
130
- void *nativeWindow() { return nativeHandle(); } // Alias
131
-
132
- // Features
133
- void setWindow(std::shared_ptr<Window> win);
134
- TrayManager &tray();
135
- WindowManager &window();
136
-
137
- private:
138
- struct Impl;
139
- std::shared_ptr<Impl> pImpl;
140
- };
141
-
142
- } // namespace plusui
1
+ #pragma once
2
+
3
+ #include <functional>
4
+ #include <future>
5
+ #include <map>
6
+ #include <memory>
7
+ #include <string>
8
+ #include <vector>
9
+
10
+ namespace plusui {
11
+
12
+ class TrayManager;
13
+ class WindowManager;
14
+ class Window;
15
+
16
+ struct WebViewConfig {
17
+ std::string userAgent = "";
18
+ bool devtools = true;
19
+ bool contextMenu = true;
20
+ bool javascript = true;
21
+ bool webSecurity = true;
22
+ bool allowFileAccess = false;
23
+ bool allowRemoteContent = true;
24
+ std::string dataPath = "";
25
+ int cacheSize = 100; // MB
26
+ bool scrollbars = true; // Show/hide scrollbars
27
+
28
+ // App Builder style config
29
+ std::string title;
30
+ int width = 800;
31
+ int height = 600;
32
+ bool resizable = true;
33
+ };
34
+
35
+ class WebView {
36
+ public:
37
+ using WindowId = uint64_t;
38
+
39
+ // Callback types
40
+ using VoidCallback = std::function<void()>;
41
+ using StringCallback = std::function<void(const std::string &result)>;
42
+ using BoolCallback = std::function<bool(const std::string &url)>;
43
+ using ErrorCallback = std::function<void(const std::string &error, int code)>;
44
+ using ConsoleCallback = std::function<void(
45
+ const std::string &message, int level, const std::string &source)>;
46
+ using JSCallback = std::function<std::string(const std::string &args)>;
47
+ using NavigationCallback = std::function<bool(const std::string &url)>;
48
+ using LoadCallback = std::function<void()>;
49
+
50
+ WebView();
51
+ // Constructor used by App::Builder
52
+ struct AppConfig;
53
+ // WebView(const AppConfig& config); // We'll handle this via create or
54
+ // similar
55
+
56
+ ~WebView();
57
+
58
+ // Move only
59
+ WebView(WebView &&other) noexcept;
60
+ WebView &operator=(WebView &&other) noexcept;
61
+ WebView(const WebView &) = delete;
62
+ WebView &operator=(const WebView &) = delete;
63
+
64
+ static WebView create(void *windowHandle, const WebViewConfig &config = {});
65
+
66
+ // Content loading
67
+ void loadURL(const std::string &url);
68
+ void loadHTML(const std::string &html);
69
+ void loadHTML(const std::string &html, const std::string &baseURL);
70
+ void loadFile(const std::string &filePath);
71
+ void navigate(const std::string &url);
72
+
73
+ // Navigation
74
+ void reload();
75
+ void stop();
76
+ void goBack();
77
+ void goForward();
78
+ bool canGoBack() const;
79
+ bool canGoForward() const;
80
+
81
+ // Scripting
82
+ void executeScript(const std::string &script);
83
+ void executeScript(const std::string &script, StringCallback callback);
84
+ void eval(const std::string &js) {
85
+ executeScript(js);
86
+ } // Alias for compatibility
87
+
88
+ template <typename T> std::future<T> evaluate(const std::string &js) {
89
+ // Implementation in cpp or inline
90
+ return std::future<T>();
91
+ }
92
+
93
+ // Bindings
94
+ void bind(const std::string &name, JSCallback callback);
95
+ void unbind(const std::string &name);
96
+
97
+ template <typename F> void expose(const std::string &name, F &&callback) {
98
+ // Implementation for simplified expose
99
+ }
100
+
101
+ // Dev tools
102
+ void openDevTools();
103
+ void closeDevTools();
104
+
105
+ // Events
106
+ void on(const std::string &event,
107
+ std::function<void(const std::string &)> callback);
108
+ void emit(const std::string &event, const std::string &data = "");
109
+
110
+ // Settings
111
+ void setUserAgent(const std::string &userAgent);
112
+ std::string getUserAgent() const;
113
+ void setZoom(double factor);
114
+ double getZoom() const;
115
+ void injectCSS(const std::string &css);
116
+
117
+ // Callbacks
118
+ void onNavigationStart(NavigationCallback callback);
119
+ void onNavigationComplete(LoadCallback callback);
120
+ void onLoadStart(LoadCallback callback);
121
+ void onLoadEnd(LoadCallback callback);
122
+ void onLoadError(ErrorCallback callback);
123
+ void onConsoleMessage(ConsoleCallback callback);
124
+
125
+ // State
126
+ bool isLoading() const;
127
+ std::string getURL() const;
128
+ std::string getTitle() const;
129
+ void *nativeHandle() const;
130
+ void *nativeWindow() { return nativeHandle(); } // Alias
131
+
132
+ // Features
133
+ void setWindow(std::shared_ptr<Window> win);
134
+ TrayManager &tray();
135
+ WindowManager &window();
136
+
137
+ private:
138
+ struct Impl;
139
+ std::shared_ptr<Impl> pImpl;
140
+ };
141
+
142
+ } // namespace plusui
@@ -1,111 +1,111 @@
1
- #pragma once
2
-
3
- #include <functional>
4
- #include <memory>
5
- #include <string>
6
- #include <vector>
7
-
8
- namespace plusui {
9
-
10
- struct WindowConfig {
11
- std::string title = "PlusUI Window";
12
- int x = -1;
13
- int y = -1;
14
- int width = 800;
15
- int height = 600;
16
- int minWidth = 100;
17
- int minHeight = 100;
18
- int maxWidth = -1;
19
- int maxHeight = -1;
20
- bool resizable = true;
21
- bool minimizable = true;
22
- bool maximizable = true;
23
- bool closable = true;
24
- bool alwaysOnTop = false;
25
- bool center = true;
26
- bool frame = true;
27
- bool transparent = false;
28
- bool decorations = true;
29
- bool skipTaskbar = false;
30
- double opacity = 1.0;
31
- bool fullscreen = false;
32
- };
33
-
34
- struct WindowState {
35
- int x = 0;
36
- int y = 0;
37
- int width = 0;
38
- int height = 0;
39
- bool isMinimized = false;
40
- bool isMaximized = false;
41
- bool isVisible = true;
42
- bool isFocused = false;
43
- bool isFullscreen = false;
44
- bool isHidden = false;
45
- };
46
-
47
- class Window {
48
- public:
49
- using MoveCallback = std::function<void(int x, int y)>;
50
- using ResizeCallback = std::function<void(int w, int h)>;
51
- using CloseCallback = std::function<void()>;
52
- using FocusCallback = std::function<void(bool focused)>;
53
- using StateCallback = std::function<void(const WindowState &state)>;
54
-
55
- Window();
56
- ~Window();
57
-
58
- static Window create(const WindowConfig &config);
59
-
60
- void setTitle(const std::string &title);
61
- std::string getTitle() const;
62
-
63
- void setSize(int width, int height);
64
- void getSize(int &width, int &height) const;
65
- void setMinSize(int width, int height);
66
- void setMaxSize(int width, int height);
67
-
68
- void setPosition(int x, int y);
69
- void getPosition(int &x, int &y) const;
70
- void center();
71
-
72
- void setFullscreen(bool enabled);
73
- bool isFullscreen() const;
74
-
75
- void minimize();
76
- void maximize();
77
- void restore();
78
- bool isMaximized() const;
79
- bool isMinimized() const;
80
-
81
- void show();
82
- void hide();
83
- bool isVisible() const;
84
- bool isHidden() const;
85
-
86
- void focus();
87
- bool isFocused() const;
88
-
89
- void setAlwaysOnTop(bool enabled);
90
- void setResizable(bool enabled);
91
- void setDecorations(bool enabled);
92
- void setSkipTaskbar(bool enabled);
93
- void setOpacity(double opacity);
94
- void setIconFromMemory(const unsigned char *data, size_t size);
95
-
96
- WindowState getState() const;
97
-
98
- void onMove(MoveCallback callback);
99
- void onResize(ResizeCallback callback);
100
- void onClose(CloseCallback callback);
101
- void onFocus(FocusCallback callback);
102
- void onStateChange(StateCallback callback);
103
-
104
- void *nativeHandle() const;
105
-
106
- private:
107
- struct Impl;
108
- std::shared_ptr<Impl> pImpl;
109
- };
110
-
111
- } // namespace plusui
1
+ #pragma once
2
+
3
+ #include <functional>
4
+ #include <memory>
5
+ #include <string>
6
+ #include <vector>
7
+
8
+ namespace plusui {
9
+
10
+ struct WindowConfig {
11
+ std::string title = "PlusUI Window";
12
+ int x = -1;
13
+ int y = -1;
14
+ int width = 800;
15
+ int height = 600;
16
+ int minWidth = 100;
17
+ int minHeight = 100;
18
+ int maxWidth = -1;
19
+ int maxHeight = -1;
20
+ bool resizable = true;
21
+ bool minimizable = true;
22
+ bool maximizable = true;
23
+ bool closable = true;
24
+ bool alwaysOnTop = false;
25
+ bool center = true;
26
+ bool frame = true;
27
+ bool transparent = false;
28
+ bool decorations = true;
29
+ bool skipTaskbar = false;
30
+ double opacity = 1.0;
31
+ bool fullscreen = false;
32
+ };
33
+
34
+ struct WindowState {
35
+ int x = 0;
36
+ int y = 0;
37
+ int width = 0;
38
+ int height = 0;
39
+ bool isMinimized = false;
40
+ bool isMaximized = false;
41
+ bool isVisible = true;
42
+ bool isFocused = false;
43
+ bool isFullscreen = false;
44
+ bool isHidden = false;
45
+ };
46
+
47
+ class Window {
48
+ public:
49
+ using MoveCallback = std::function<void(int x, int y)>;
50
+ using ResizeCallback = std::function<void(int w, int h)>;
51
+ using CloseCallback = std::function<void()>;
52
+ using FocusCallback = std::function<void(bool focused)>;
53
+ using StateCallback = std::function<void(const WindowState &state)>;
54
+
55
+ Window();
56
+ ~Window();
57
+
58
+ static Window create(const WindowConfig &config);
59
+
60
+ void setTitle(const std::string &title);
61
+ std::string getTitle() const;
62
+
63
+ void setSize(int width, int height);
64
+ void getSize(int &width, int &height) const;
65
+ void setMinSize(int width, int height);
66
+ void setMaxSize(int width, int height);
67
+
68
+ void setPosition(int x, int y);
69
+ void getPosition(int &x, int &y) const;
70
+ void center();
71
+
72
+ void setFullscreen(bool enabled);
73
+ bool isFullscreen() const;
74
+
75
+ void minimize();
76
+ void maximize();
77
+ void restore();
78
+ bool isMaximized() const;
79
+ bool isMinimized() const;
80
+
81
+ void show();
82
+ void hide();
83
+ bool isVisible() const;
84
+ bool isHidden() const;
85
+
86
+ void focus();
87
+ bool isFocused() const;
88
+
89
+ void setAlwaysOnTop(bool enabled);
90
+ void setResizable(bool enabled);
91
+ void setDecorations(bool enabled);
92
+ void setSkipTaskbar(bool enabled);
93
+ void setOpacity(double opacity);
94
+ void setIconFromMemory(const unsigned char *data, size_t size);
95
+
96
+ WindowState getState() const;
97
+
98
+ void onMove(MoveCallback callback);
99
+ void onResize(ResizeCallback callback);
100
+ void onClose(CloseCallback callback);
101
+ void onFocus(FocusCallback callback);
102
+ void onStateChange(StateCallback callback);
103
+
104
+ void *nativeHandle() const;
105
+
106
+ private:
107
+ struct Impl;
108
+ std::shared_ptr<Impl> pImpl;
109
+ };
110
+
111
+ } // namespace plusui
@@ -1,59 +1,59 @@
1
- #ifndef PLUSUI_WINDOW_MANAGER_H
2
- #define PLUSUI_WINDOW_MANAGER_H
3
-
4
- #include <string>
5
- #include <memory>
6
-
7
- namespace plusui {
8
-
9
- struct WindowSize {
10
- int width = 0;
11
- int height = 0;
12
- };
13
-
14
- struct WindowPosition {
15
- int x = 0;
16
- int y = 0;
17
- };
18
-
19
- class WindowManager {
20
- public:
21
- WindowManager();
22
- explicit WindowManager(void* nativeWindow);
23
- ~WindowManager();
24
-
25
- // Window operations
26
- void setTitle(const std::string& title);
27
- void setSize(int width, int height);
28
- WindowSize getSize() const;
29
- void setPosition(int x, int y);
30
- WindowPosition getPosition() const;
31
- void setCenter();
32
- void setFullscreen(bool enabled);
33
- void setAlwaysOnTop(bool enabled);
34
- void setResizable(bool enabled);
35
- void setDecorations(bool enabled);
36
- void setSkipTaskbar(bool enabled);
37
- void setTransparency(double alpha);
38
- void setIcon(const std::string& iconPath);
39
- void setIconFromMemory(const unsigned char *data, size_t size);
40
-
41
- void minimize();
42
- void maximize();
43
- void restore();
44
- void show();
45
- void hide();
46
- void close();
47
-
48
- bool isMaximized() const;
49
- bool isMinimized() const;
50
- bool isVisible() const;
51
-
52
- private:
53
- struct Impl;
54
- std::unique_ptr<Impl> pImpl;
55
- };
56
-
57
- } // namespace plusui
58
-
59
- #endif
1
+ #ifndef PLUSUI_WINDOW_MANAGER_H
2
+ #define PLUSUI_WINDOW_MANAGER_H
3
+
4
+ #include <string>
5
+ #include <memory>
6
+
7
+ namespace plusui {
8
+
9
+ struct WindowSize {
10
+ int width = 0;
11
+ int height = 0;
12
+ };
13
+
14
+ struct WindowPosition {
15
+ int x = 0;
16
+ int y = 0;
17
+ };
18
+
19
+ class WindowManager {
20
+ public:
21
+ WindowManager();
22
+ explicit WindowManager(void* nativeWindow);
23
+ ~WindowManager();
24
+
25
+ // Window operations
26
+ void setTitle(const std::string& title);
27
+ void setSize(int width, int height);
28
+ WindowSize getSize() const;
29
+ void setPosition(int x, int y);
30
+ WindowPosition getPosition() const;
31
+ void setCenter();
32
+ void setFullscreen(bool enabled);
33
+ void setAlwaysOnTop(bool enabled);
34
+ void setResizable(bool enabled);
35
+ void setDecorations(bool enabled);
36
+ void setSkipTaskbar(bool enabled);
37
+ void setTransparency(double alpha);
38
+ void setIcon(const std::string& iconPath);
39
+ void setIconFromMemory(const unsigned char *data, size_t size);
40
+
41
+ void minimize();
42
+ void maximize();
43
+ void restore();
44
+ void show();
45
+ void hide();
46
+ void close();
47
+
48
+ bool isMaximized() const;
49
+ bool isMinimized() const;
50
+ bool isVisible() const;
51
+
52
+ private:
53
+ struct Impl;
54
+ std::unique_ptr<Impl> pImpl;
55
+ };
56
+
57
+ } // namespace plusui
58
+
59
+ #endif
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "plusui-native-core",
3
- "version": "0.1.21",
3
+ "version": "0.1.23",
4
4
  "description": "PlusUI Core framework (frontend + backend implementations)",
5
5
  "type": "module",
6
6
  "files": [