plusui-native-core 0.1.105 → 0.1.107
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.
- package/Core/.cache/clangd/index/api.hpp.016B34C8046EF490.idx +0 -0
- package/Core/.cache/clangd/index/app.cpp.1E6FAF043D496421.idx +0 -0
- package/Core/.cache/clangd/index/app.hpp.FA0E5D412C4E6148.idx +0 -0
- package/Core/.cache/clangd/index/browser.cpp.9461A2CAF129F1D9.idx +0 -0
- package/Core/.cache/clangd/index/browser.hpp.BE40AE80881B3107.idx +0 -0
- package/Core/.cache/clangd/index/clipboard.cpp.2399913537B2A7AD.idx +0 -0
- package/Core/.cache/clangd/index/clipboard.hpp.C1095DDACD7149E9.idx +0 -0
- package/Core/.cache/clangd/index/connect.cpp.518C66C7C28B30A9.idx +0 -0
- package/Core/.cache/clangd/index/connect.hpp.08E2F7CD13B78601.idx +0 -0
- package/Core/.cache/clangd/index/connection.hpp.849FAEF1523BF2C3.idx +0 -0
- package/Core/.cache/clangd/index/display.cpp.F6F6D932BF9F8D8E.idx +0 -0
- package/Core/.cache/clangd/index/display.hpp.0C1A9CAD11EE4404.idx +0 -0
- package/Core/.cache/clangd/index/filedrop.cpp.669B524B3C501C52.idx +0 -0
- package/Core/.cache/clangd/index/filedrop.hpp.48460099C3F35F2D.idx +0 -0
- package/Core/.cache/clangd/index/keyboard.cpp.DC6D34E4A4F798DD.idx +0 -0
- package/Core/.cache/clangd/index/keyboard.hpp.F016CB68D7DE5A46.idx +0 -0
- package/Core/.cache/clangd/index/keyboard_linux.cpp.B403FDCEA7A6CA53.idx +0 -0
- package/Core/.cache/clangd/index/menu.cpp.3059F08D8D2DF265.idx +0 -0
- package/Core/.cache/clangd/index/menu.hpp.8716DCCC573910D4.idx +0 -0
- package/Core/.cache/clangd/index/plusui.hpp.8CFCDFDC2E3F41DD.idx +0 -0
- package/Core/.cache/clangd/index/router.cpp.EAC9EAD34C59E573.idx +0 -0
- package/Core/.cache/clangd/index/router.hpp.2B06E2EE9998468D.idx +0 -0
- package/Core/.cache/clangd/index/stb_image.h.E26CF48FE089A0D3.idx +0 -0
- package/Core/.cache/clangd/index/tray.cpp.92F244E7E1D7F0EC.idx +0 -0
- package/Core/.cache/clangd/index/tray.hpp.0D881B0601BBBD25.idx +0 -0
- package/Core/.cache/clangd/index/webgpu.cpp.FC656FA8BE10FE15.idx +0 -0
- package/Core/.cache/clangd/index/webgpu.hpp.5AF1A5E9DF9E5AE0.idx +0 -0
- package/Core/.cache/clangd/index/window.cpp.191D8C9ADF874B22.idx +0 -0
- package/Core/.cache/clangd/index/window.hpp.B9811B43AA295697.idx +0 -0
- package/Core/.claude/settings.local.json +7 -0
- package/Core/CMakeLists.txt +1 -1
- package/Core/Features/API/app-api.ts +28 -28
- package/Core/Features/API/browser-api.ts +38 -38
- package/Core/Features/API/clipboard-api.ts +21 -21
- package/Core/Features/API/display-api.ts +33 -33
- package/Core/Features/API/keyboard-api.ts +33 -33
- package/Core/Features/API/menu-api.ts +39 -39
- package/Core/Features/API/router-api.ts +23 -23
- package/Core/Features/API/tray-api.ts +22 -22
- package/Core/Features/API/webgpu-api.ts +55 -55
- package/Core/Features/App/app.cpp +135 -102
- package/Core/Features/Browser/browser.cpp +227 -227
- package/Core/Features/Browser/browser.ts +161 -161
- package/Core/Features/Clipboard/clipboard.cpp +235 -235
- package/Core/Features/Display/display.cpp +212 -212
- package/Core/Features/FileDrop/filedrop.cpp +448 -324
- package/Core/Features/FileDrop/filedrop.css +421 -421
- package/Core/Features/FileDrop/filedrop.ts +0 -7
- package/Core/Features/Keyboard/keyboard_linux.cpp +4 -0
- package/Core/Features/Router/router.cpp +62 -62
- package/Core/Features/Router/router.ts +113 -113
- package/Core/Features/Tray/tray.cpp +437 -324
- package/Core/Features/WebGPU/webgpu.cpp +948 -948
- package/Core/Features/Window/webview.cpp +1009 -1009
- package/Core/Features/Window/webview.ts +516 -516
- package/Core/Features/Window/window.cpp +2240 -1986
- package/Core/include/plusui/api.hpp +237 -237
- package/Core/include/plusui/app.hpp +36 -34
- package/Core/include/plusui/browser.hpp +67 -67
- package/Core/include/plusui/clipboard.hpp +41 -41
- package/Core/include/plusui/connect.hpp +340 -340
- package/Core/include/plusui/connection.hpp +3 -3
- package/Core/include/plusui/display.hpp +90 -90
- package/Core/include/plusui/filedrop.hpp +92 -77
- package/Core/include/plusui/keyboard.hpp +112 -112
- package/Core/include/plusui/menu.hpp +153 -153
- package/Core/include/plusui/plusui +18 -18
- package/Core/include/plusui/router.hpp +42 -42
- package/Core/include/plusui/tray.hpp +94 -94
- package/Core/include/plusui/webgpu.hpp +434 -434
- package/Core/include/plusui/window.hpp +180 -177
- package/Core/scripts/generate-umbrella-header.mjs +77 -77
- package/Core/vendor/WebView2EnvironmentOptions.h +406 -406
- package/Core/vendor/webview.h +487 -487
- package/Core/vendor/webview2.h +52079 -52079
- package/README.md +19 -19
- package/package.json +1 -1
|
@@ -1,16 +1,16 @@
|
|
|
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
|
-
|
|
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
|
+
|
|
14
14
|
struct WindowConfig {
|
|
15
15
|
// Window properties
|
|
16
16
|
std::string title = "PlusUI Window";
|
|
@@ -49,167 +49,170 @@ struct WindowConfig {
|
|
|
49
49
|
int cacheSize = 100; // MB
|
|
50
50
|
bool scrollbars = true; // Show/hide scrollbars
|
|
51
51
|
};
|
|
52
|
-
|
|
53
|
-
struct WindowState {
|
|
54
|
-
int x = 0;
|
|
55
|
-
int y = 0;
|
|
56
|
-
int width = 0;
|
|
57
|
-
int height = 0;
|
|
58
|
-
bool isMinimized = false;
|
|
59
|
-
bool isMaximized = false;
|
|
60
|
-
bool isVisible = true;
|
|
61
|
-
bool isFocused = false;
|
|
62
|
-
bool isFullscreen = false;
|
|
63
|
-
bool isHidden = false;
|
|
64
|
-
};
|
|
65
|
-
|
|
66
|
-
class Window {
|
|
67
|
-
public:
|
|
68
|
-
using MoveCallback = std::function<void(int x, int y)>;
|
|
69
|
-
using ResizeCallback = std::function<void(int w, int h)>;
|
|
70
|
-
using CloseCallback = std::function<void()>;
|
|
71
|
-
using FocusCallback = std::function<void(bool focused)>;
|
|
72
|
-
using StateCallback = std::function<void(const WindowState &state)>;
|
|
73
|
-
|
|
74
|
-
Window();
|
|
75
|
-
~Window();
|
|
76
|
-
|
|
77
|
-
// Move only
|
|
78
|
-
Window(Window &&other) noexcept;
|
|
79
|
-
Window &operator=(Window &&other) noexcept;
|
|
80
|
-
Window(const Window &) = delete;
|
|
81
|
-
Window &operator=(const Window &) = delete;
|
|
82
|
-
|
|
83
|
-
static Window create(const WindowConfig &config);
|
|
84
|
-
static Window create(void *windowHandle, const WindowConfig &config);
|
|
85
|
-
|
|
86
|
-
void setTitle(const std::string &title);
|
|
87
|
-
std::string getTitle() const;
|
|
88
|
-
|
|
89
|
-
void setSize(int width, int height);
|
|
90
|
-
void getSize(int &width, int &height) const;
|
|
91
|
-
void setMinSize(int width, int height);
|
|
92
|
-
void setMaxSize(int width, int height);
|
|
93
|
-
|
|
94
|
-
void setPosition(int x, int y);
|
|
95
|
-
void getPosition(int &x, int &y) const;
|
|
96
|
-
void center();
|
|
97
|
-
|
|
98
|
-
void setFullscreen(bool enabled);
|
|
99
|
-
bool isFullscreen() const;
|
|
100
|
-
|
|
101
|
-
void minimize();
|
|
102
|
-
void maximize();
|
|
103
|
-
void restore();
|
|
104
|
-
bool isMaximized() const;
|
|
105
|
-
bool isMinimized() const;
|
|
106
|
-
|
|
107
|
-
void show();
|
|
108
|
-
void hide();
|
|
109
|
-
void close();
|
|
110
|
-
bool isVisible() const;
|
|
111
|
-
bool isHidden() const;
|
|
112
|
-
|
|
113
|
-
void focus();
|
|
114
|
-
bool isFocused() const;
|
|
115
|
-
|
|
116
|
-
void setAlwaysOnTop(bool enabled);
|
|
117
|
-
void setResizable(bool enabled);
|
|
118
|
-
void setDecorations(bool enabled);
|
|
119
|
-
void setSkipTaskbar(bool enabled);
|
|
120
|
-
void setOpacity(double opacity);
|
|
121
|
-
void setIconFromMemory(const unsigned char *data, size_t size);
|
|
122
|
-
|
|
123
|
-
WindowState getState() const;
|
|
124
|
-
|
|
125
|
-
void onMove(MoveCallback callback);
|
|
126
|
-
void onResize(ResizeCallback callback);
|
|
127
|
-
void onClose(CloseCallback callback);
|
|
128
|
-
void onFocus(FocusCallback callback);
|
|
129
|
-
void onStateChange(StateCallback callback);
|
|
130
|
-
|
|
131
|
-
using FileDropCallback = std::function<void(const std::string &)>;
|
|
132
|
-
void onFileDrop(FileDropCallback callback);
|
|
133
|
-
|
|
134
|
-
void *nativeHandle() const;
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
using
|
|
141
|
-
using
|
|
142
|
-
using
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
using
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
void
|
|
149
|
-
void loadHTML(const std::string &html
|
|
150
|
-
void
|
|
151
|
-
void
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
void
|
|
156
|
-
void
|
|
157
|
-
void
|
|
158
|
-
|
|
159
|
-
bool
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
void executeScript(const std::string &script
|
|
165
|
-
void
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
void
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
void
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
std::string
|
|
185
|
-
|
|
186
|
-
double
|
|
187
|
-
|
|
188
|
-
void
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
void
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
void
|
|
198
|
-
void
|
|
199
|
-
void
|
|
200
|
-
void
|
|
201
|
-
void
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
52
|
+
|
|
53
|
+
struct WindowState {
|
|
54
|
+
int x = 0;
|
|
55
|
+
int y = 0;
|
|
56
|
+
int width = 0;
|
|
57
|
+
int height = 0;
|
|
58
|
+
bool isMinimized = false;
|
|
59
|
+
bool isMaximized = false;
|
|
60
|
+
bool isVisible = true;
|
|
61
|
+
bool isFocused = false;
|
|
62
|
+
bool isFullscreen = false;
|
|
63
|
+
bool isHidden = false;
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
class Window {
|
|
67
|
+
public:
|
|
68
|
+
using MoveCallback = std::function<void(int x, int y)>;
|
|
69
|
+
using ResizeCallback = std::function<void(int w, int h)>;
|
|
70
|
+
using CloseCallback = std::function<void()>;
|
|
71
|
+
using FocusCallback = std::function<void(bool focused)>;
|
|
72
|
+
using StateCallback = std::function<void(const WindowState &state)>;
|
|
73
|
+
|
|
74
|
+
Window();
|
|
75
|
+
~Window();
|
|
76
|
+
|
|
77
|
+
// Move only
|
|
78
|
+
Window(Window &&other) noexcept;
|
|
79
|
+
Window &operator=(Window &&other) noexcept;
|
|
80
|
+
Window(const Window &) = delete;
|
|
81
|
+
Window &operator=(const Window &) = delete;
|
|
82
|
+
|
|
83
|
+
static Window create(const WindowConfig &config);
|
|
84
|
+
static Window create(void *windowHandle, const WindowConfig &config);
|
|
85
|
+
|
|
86
|
+
void setTitle(const std::string &title);
|
|
87
|
+
std::string getTitle() const;
|
|
88
|
+
|
|
89
|
+
void setSize(int width, int height);
|
|
90
|
+
void getSize(int &width, int &height) const;
|
|
91
|
+
void setMinSize(int width, int height);
|
|
92
|
+
void setMaxSize(int width, int height);
|
|
93
|
+
|
|
94
|
+
void setPosition(int x, int y);
|
|
95
|
+
void getPosition(int &x, int &y) const;
|
|
96
|
+
void center();
|
|
97
|
+
|
|
98
|
+
void setFullscreen(bool enabled);
|
|
99
|
+
bool isFullscreen() const;
|
|
100
|
+
|
|
101
|
+
void minimize();
|
|
102
|
+
void maximize();
|
|
103
|
+
void restore();
|
|
104
|
+
bool isMaximized() const;
|
|
105
|
+
bool isMinimized() const;
|
|
106
|
+
|
|
107
|
+
void show();
|
|
108
|
+
void hide();
|
|
109
|
+
void close();
|
|
110
|
+
bool isVisible() const;
|
|
111
|
+
bool isHidden() const;
|
|
112
|
+
|
|
113
|
+
void focus();
|
|
114
|
+
bool isFocused() const;
|
|
115
|
+
|
|
116
|
+
void setAlwaysOnTop(bool enabled);
|
|
117
|
+
void setResizable(bool enabled);
|
|
118
|
+
void setDecorations(bool enabled);
|
|
119
|
+
void setSkipTaskbar(bool enabled);
|
|
120
|
+
void setOpacity(double opacity);
|
|
121
|
+
void setIconFromMemory(const unsigned char *data, size_t size);
|
|
122
|
+
|
|
123
|
+
WindowState getState() const;
|
|
124
|
+
|
|
125
|
+
void onMove(MoveCallback callback);
|
|
126
|
+
void onResize(ResizeCallback callback);
|
|
127
|
+
void onClose(CloseCallback callback);
|
|
128
|
+
void onFocus(FocusCallback callback);
|
|
129
|
+
void onStateChange(StateCallback callback);
|
|
130
|
+
|
|
131
|
+
using FileDropCallback = std::function<void(const std::string &)>;
|
|
132
|
+
void onFileDrop(FileDropCallback callback);
|
|
133
|
+
|
|
134
|
+
void *nativeHandle() const;
|
|
135
|
+
void *nativeWebView() const;
|
|
136
|
+
|
|
137
|
+
void setWindow(std::shared_ptr<Window> win);
|
|
138
|
+
|
|
139
|
+
// WebView methods (content loading)
|
|
140
|
+
using StringCallback = std::function<void(const std::string &result)>;
|
|
141
|
+
using BoolCallback = std::function<bool(const std::string &url)>;
|
|
142
|
+
using ErrorCallback = std::function<void(const std::string &error, int code)>;
|
|
143
|
+
using ConsoleCallback = std::function<void(
|
|
144
|
+
const std::string &message, int level, const std::string &source)>;
|
|
145
|
+
using NavigationCallback = std::function<bool(const std::string &url)>;
|
|
146
|
+
using LoadCallback = std::function<void()>;
|
|
147
|
+
|
|
148
|
+
void loadURL(const std::string &url);
|
|
149
|
+
void loadHTML(const std::string &html);
|
|
150
|
+
void loadHTML(const std::string &html, const std::string &baseURL);
|
|
151
|
+
void loadFile(const std::string &filePath);
|
|
152
|
+
void navigate(const std::string &url);
|
|
153
|
+
|
|
154
|
+
// Navigation
|
|
155
|
+
void reload();
|
|
156
|
+
void stop();
|
|
157
|
+
void goBack();
|
|
158
|
+
void goForward();
|
|
159
|
+
bool canGoBack() const;
|
|
160
|
+
bool canGoForward() const;
|
|
161
|
+
|
|
162
|
+
// Scripting
|
|
163
|
+
using JSCallback = std::function<std::string(const std::string &)>;
|
|
164
|
+
void executeScript(const std::string &script);
|
|
165
|
+
void executeScript(const std::string &script, StringCallback callback);
|
|
166
|
+
void eval(const std::string &js) {
|
|
167
|
+
executeScript(js);
|
|
168
|
+
} // Alias for compatibility
|
|
169
|
+
void bind(const std::string &name, JSCallback callback);
|
|
170
|
+
void unbind(const std::string &name);
|
|
171
|
+
|
|
172
|
+
template <typename T> std::future<T> evaluate(const std::string &js) {
|
|
173
|
+
// Implementation in cpp or inline
|
|
174
|
+
return std::future<T>();
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
// Dev tools
|
|
178
|
+
void openDevTools();
|
|
179
|
+
void closeDevTools();
|
|
180
|
+
|
|
181
|
+
// WebView settings
|
|
182
|
+
|
|
183
|
+
// WebView settings
|
|
184
|
+
void setUserAgent(const std::string &userAgent);
|
|
185
|
+
std::string getUserAgent() const;
|
|
186
|
+
void setZoom(double factor);
|
|
187
|
+
double getZoom() const;
|
|
188
|
+
void injectCSS(const std::string &css);
|
|
189
|
+
void setWebviewDragDropEnabled(
|
|
190
|
+
bool enabled); // Enable/disable webview drag-drop at runtime
|
|
191
|
+
|
|
192
|
+
using MessageCallback = std::function<void(const std::string &)>;
|
|
193
|
+
void onMessage(MessageCallback callback);
|
|
194
|
+
void postMessage(const std::string &message);
|
|
195
|
+
|
|
196
|
+
// WebView callbacks
|
|
197
|
+
void onNavigationStart(NavigationCallback callback);
|
|
198
|
+
void onNavigationComplete(LoadCallback callback);
|
|
199
|
+
void onLoadStart(LoadCallback callback);
|
|
200
|
+
void onLoadEnd(LoadCallback callback);
|
|
201
|
+
void onLoadError(ErrorCallback callback);
|
|
202
|
+
void onConsoleMessage(ConsoleCallback callback);
|
|
203
|
+
|
|
204
|
+
// WebView state
|
|
205
|
+
bool isLoading() const;
|
|
206
|
+
std::string getURL() const;
|
|
207
|
+
|
|
208
|
+
// Features
|
|
209
|
+
TrayManager &tray();
|
|
210
|
+
|
|
211
|
+
public:
|
|
212
|
+
struct Impl;
|
|
213
|
+
|
|
214
|
+
private:
|
|
215
|
+
std::shared_ptr<Impl> pImpl;
|
|
216
|
+
};
|
|
217
|
+
|
|
218
|
+
} // namespace plusui
|
|
@@ -1,77 +1,77 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
/**
|
|
3
|
-
* Generate the plusui.hpp umbrella header
|
|
4
|
-
*
|
|
5
|
-
* This script automatically scans all .hpp files in Core/include/plusui/
|
|
6
|
-
* and generates the umbrella header that includes them all.
|
|
7
|
-
*
|
|
8
|
-
* Run this whenever you add a new header file to the framework.
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
import { readdir, writeFile } from 'node:fs/promises';
|
|
12
|
-
import { resolve, dirname } from 'node:path';
|
|
13
|
-
import { fileURLToPath } from 'node:url';
|
|
14
|
-
|
|
15
|
-
const __filename = fileURLToPath(import.meta.url);
|
|
16
|
-
const __dirname = dirname(__filename);
|
|
17
|
-
|
|
18
|
-
const includeDir = resolve(__dirname, '../include/plusui');
|
|
19
|
-
const outputFile = resolve(includeDir, 'plusui.hpp');
|
|
20
|
-
|
|
21
|
-
async function generateUmbrellaHeader() {
|
|
22
|
-
// Read all files in the include directory
|
|
23
|
-
const files = await readdir(includeDir);
|
|
24
|
-
|
|
25
|
-
// Filter to only .hpp files, excluding plusui.hpp itself
|
|
26
|
-
const headerFiles = files
|
|
27
|
-
.filter(file => file.endsWith('.hpp') && file !== 'plusui.hpp')
|
|
28
|
-
.sort();
|
|
29
|
-
|
|
30
|
-
if (headerFiles.length === 0) {
|
|
31
|
-
throw new Error('No header files found to include');
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
// Generate the header content
|
|
35
|
-
const includes = headerFiles
|
|
36
|
-
.map(file => `#include <plusui/${file}>`)
|
|
37
|
-
.join('\n');
|
|
38
|
-
|
|
39
|
-
const content = `#pragma once
|
|
40
|
-
|
|
41
|
-
/**
|
|
42
|
-
* PlusUI - Umbrella Header (Auto-generated)
|
|
43
|
-
*
|
|
44
|
-
* This file is automatically generated by scripts/generate-umbrella-header.mjs
|
|
45
|
-
* DO NOT EDIT MANUALLY - your changes will be overwritten!
|
|
46
|
-
*
|
|
47
|
-
* To regenerate: node Core/scripts/generate-umbrella-header.mjs
|
|
48
|
-
*
|
|
49
|
-
* This umbrella header includes all PlusUI framework headers.
|
|
50
|
-
* Include this single file to access the entire framework:
|
|
51
|
-
*
|
|
52
|
-
* Usage:
|
|
53
|
-
* #include <plusui> // Standard library style (recommended)
|
|
54
|
-
* // OR
|
|
55
|
-
* #include <plusui/plusui.hpp>
|
|
56
|
-
*
|
|
57
|
-
* using namespace plusui;
|
|
58
|
-
*
|
|
59
|
-
* For faster compile times in production, you can include only
|
|
60
|
-
* the specific headers you need instead of this convenience header.
|
|
61
|
-
*/
|
|
62
|
-
|
|
63
|
-
${includes}
|
|
64
|
-
`;
|
|
65
|
-
|
|
66
|
-
// Write the generated header
|
|
67
|
-
await writeFile(outputFile, content, 'utf8');
|
|
68
|
-
|
|
69
|
-
console.log('✓ Generated plusui.hpp');
|
|
70
|
-
console.log(` Included ${headerFiles.length} headers:`);
|
|
71
|
-
headerFiles.forEach(file => console.log(` - ${file}`));
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
generateUmbrellaHeader().catch((error) => {
|
|
75
|
-
console.error(`Failed to generate umbrella header: ${error.message}`);
|
|
76
|
-
process.exit(1);
|
|
77
|
-
});
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* Generate the plusui.hpp umbrella header
|
|
4
|
+
*
|
|
5
|
+
* This script automatically scans all .hpp files in Core/include/plusui/
|
|
6
|
+
* and generates the umbrella header that includes them all.
|
|
7
|
+
*
|
|
8
|
+
* Run this whenever you add a new header file to the framework.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
import { readdir, writeFile } from 'node:fs/promises';
|
|
12
|
+
import { resolve, dirname } from 'node:path';
|
|
13
|
+
import { fileURLToPath } from 'node:url';
|
|
14
|
+
|
|
15
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
16
|
+
const __dirname = dirname(__filename);
|
|
17
|
+
|
|
18
|
+
const includeDir = resolve(__dirname, '../include/plusui');
|
|
19
|
+
const outputFile = resolve(includeDir, 'plusui.hpp');
|
|
20
|
+
|
|
21
|
+
async function generateUmbrellaHeader() {
|
|
22
|
+
// Read all files in the include directory
|
|
23
|
+
const files = await readdir(includeDir);
|
|
24
|
+
|
|
25
|
+
// Filter to only .hpp files, excluding plusui.hpp itself
|
|
26
|
+
const headerFiles = files
|
|
27
|
+
.filter(file => file.endsWith('.hpp') && file !== 'plusui.hpp')
|
|
28
|
+
.sort();
|
|
29
|
+
|
|
30
|
+
if (headerFiles.length === 0) {
|
|
31
|
+
throw new Error('No header files found to include');
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
// Generate the header content
|
|
35
|
+
const includes = headerFiles
|
|
36
|
+
.map(file => `#include <plusui/${file}>`)
|
|
37
|
+
.join('\n');
|
|
38
|
+
|
|
39
|
+
const content = `#pragma once
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* PlusUI - Umbrella Header (Auto-generated)
|
|
43
|
+
*
|
|
44
|
+
* This file is automatically generated by scripts/generate-umbrella-header.mjs
|
|
45
|
+
* DO NOT EDIT MANUALLY - your changes will be overwritten!
|
|
46
|
+
*
|
|
47
|
+
* To regenerate: node Core/scripts/generate-umbrella-header.mjs
|
|
48
|
+
*
|
|
49
|
+
* This umbrella header includes all PlusUI framework headers.
|
|
50
|
+
* Include this single file to access the entire framework:
|
|
51
|
+
*
|
|
52
|
+
* Usage:
|
|
53
|
+
* #include <plusui> // Standard library style (recommended)
|
|
54
|
+
* // OR
|
|
55
|
+
* #include <plusui/plusui.hpp>
|
|
56
|
+
*
|
|
57
|
+
* using namespace plusui;
|
|
58
|
+
*
|
|
59
|
+
* For faster compile times in production, you can include only
|
|
60
|
+
* the specific headers you need instead of this convenience header.
|
|
61
|
+
*/
|
|
62
|
+
|
|
63
|
+
${includes}
|
|
64
|
+
`;
|
|
65
|
+
|
|
66
|
+
// Write the generated header
|
|
67
|
+
await writeFile(outputFile, content, 'utf8');
|
|
68
|
+
|
|
69
|
+
console.log('✓ Generated plusui.hpp');
|
|
70
|
+
console.log(` Included ${headerFiles.length} headers:`);
|
|
71
|
+
headerFiles.forEach(file => console.log(` - ${file}`));
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
generateUmbrellaHeader().catch((error) => {
|
|
75
|
+
console.error(`Failed to generate umbrella header: ${error.message}`);
|
|
76
|
+
process.exit(1);
|
|
77
|
+
});
|