plusui-native 0.2.18 → 0.2.20

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "plusui-native",
3
- "version": "0.2.18",
3
+ "version": "0.2.20",
4
4
  "description": "PlusUI CLI - Build C++ desktop apps modern UI ",
5
5
  "main": "src/index.js",
6
6
  "type": "module",
@@ -27,11 +27,11 @@
27
27
  "semver": "^7.6.0",
28
28
  "which": "^4.0.0",
29
29
  "execa": "^8.0.1",
30
- "plusui-native-builder": "^0.1.17",
31
- "plusui-native-bindgen": "^0.1.17"
30
+ "plusui-native-builder": "^0.1.19",
31
+ "plusui-native-bindgen": "^0.1.19"
32
32
  },
33
33
  "peerDependencies": {
34
- "plusui-native-bindgen": "^0.1.17"
34
+ "plusui-native-bindgen": "^0.1.19"
35
35
  },
36
36
  "publishConfig": {
37
37
  "access": "public"
@@ -46,17 +46,17 @@ function App() {
46
46
  setIsDragging(false);
47
47
  });
48
48
 
49
+ // Get initial state
50
+ browser.getUrl().then(setCurrentUrl);
51
+ browser.canGoBack().then(setCanGoBack);
52
+ browser.canGoForward().then(setCanGoForward);
53
+
49
54
  return () => {
50
55
  unsub();
51
56
  unsubDrop();
52
57
  unsubEnter();
53
58
  unsubLeave();
54
- }al state
55
- browser.getUrl().then(setCurrentUrl);
56
- browser.canGoBack().then(setCanGoBack);
57
- browser.canGoForward().then(setCanGoForward);
58
-
59
- return unsub;
59
+ };
60
60
  }, []);
61
61
 
62
62
  const handleMinimize = async () => await win.minimize();
@@ -126,8 +126,32 @@ function App() {
126
126
  <div className="button-group">
127
127
  <button onClick={handleGoBack} className="button" disabled={!canGoBack}>Back</button>
128
128
  <button onClick={handleGoForward} className="button" disabled={!canGoForward}>Forward</button>
129
- <button onClcard">
129
+ <button onClick={handleReload} className="button">Reload</button>
130
+ </div>
131
+ </div>
132
+
133
+ <div className="card">
134
+ <h2>Router (SPA Navigation)</h2>
135
+ <div className="button-group">
136
+ <button onClick={handleGoHome} className="button">Home /</button>
137
+ <button onClick={handleGoSettings} className="button">Settings</button>
138
+ </div>
139
+ <p style={{ fontSize: '0.85em', color: '#666', marginTop: '10px' }}>
140
+ Define routes with <code>router.setRoutes({'{ ... }'})</code> then navigate with <code>router.push('/path')</code>
141
+ </p>
142
+ </div>
143
+
144
+ <div className="card">
145
+ <h2>App Control</h2>
146
+ <button onClick={handleQuit} className="button button-danger">Quit App</button>
147
+ </div>
148
+
149
+ <div className="card">
130
150
  <h2>FileDrop - Drag & Drop Files</h2>
151
+ <p style={{ fontSize: '0.85em', color: '#aaa', marginBottom: '1rem' }}>
152
+ Native file drop is enabled. The webview's default drag & drop behavior is disabled
153
+ to prevent files from opening in the browser, allowing your FileDrop handlers to work.
154
+ </p>
131
155
 
132
156
  <div style={{ marginBottom: '1rem' }}>
133
157
  <label style={{ marginRight: '0.5rem', fontSize: '0.9em' }}>Style:</label>
@@ -1,8 +1,9 @@
1
- #include <plusui/app.hpp>
2
- #include <plusui/window.hpp>
1
+ #include <plusui> // All-in-one framework header
3
2
  #include <iostream>
4
3
  #include "generated/assets.h"
5
4
 
5
+ using namespace plusui;
6
+
6
7
  // ============================================================================
7
8
  // {{PROJECT_NAME}} - Configuration
8
9
  // ============================================================================
@@ -104,7 +105,7 @@ struct WebGPUConfig {
104
105
  // ============================================================================
105
106
  int main() {
106
107
  // Use your app name as the variable name
107
- auto {{PROJECT_NAME_LOWER}} = plusui::createApp()
108
+ auto {{PROJECT_NAME_LOWER}} = createApp()
108
109
  .title(appConfig.name)
109
110
  .width(windowConfig.width)
110
111
  .height(windowConfig.height)
@@ -172,24 +173,24 @@ int main() {
172
173
  // FILE DROP EVENTS (Drag & Drop)
173
174
  // ========================================
174
175
  // Listen for files dropped into the window
175
- plusui::event::on("fileDrop.filesDropped", [](const std::string& data) {
176
+ event::on("fileDrop.filesDropped", [](const std::string& data) {
176
177
  std::cout << "Files dropped: " << data << std::endl;
177
178
  // Parse the JSON data to get file info
178
179
  // You can process files here in C++
179
180
  });
180
181
 
181
- plusui::event::on("fileDrop.dragEnter", [](const std::string&) {
182
+ event::on("fileDrop.dragEnter", [](const std::string&) {
182
183
  std::cout << "Drag entered window" << std::endl;
183
184
  });
184
185
 
185
- plusui::event::on("fileDrop.dragLeave", [](const std::string&) {
186
+ event::on("fileDrop.dragLeave", [](const std::string&) {
186
187
  std::cout << "Drag left window" << std::endl;
187
188
  });
188
189
 
189
190
  // ========================================
190
191
  // RUN APPLICATION
191
192
  // ========================================
192
- plusui::App runtime;
193
+ App runtime;
193
194
  runtime.run();
194
195
 
195
196
  return 0;
@@ -147,6 +147,10 @@ function App() {
147
147
 
148
148
  <div class="card">
149
149
  <h2>FileDrop - Drag & Drop Files</h2>
150
+ <p style={{ 'font-size': '0.85em', color: '#aaa', 'margin-bottom': '1rem' }}>
151
+ Native file drop is enabled. The webview's default drag & drop behavior is disabled
152
+ to prevent files from opening in the browser, allowing your FileDrop handlers to work.
153
+ </p>
150
154
 
151
155
  <div style={{ 'margin-bottom': '1rem' }}>
152
156
  <label style={{ 'margin-right': '0.5rem', 'font-size': '0.9em' }}>Style:</label>
@@ -1,8 +1,9 @@
1
- #include <plusui/app.hpp>
2
- #include <plusui/window.hpp>
1
+ #include <plusui> // All-in-one framework header
3
2
  #include <iostream>
4
3
  #include "generated/assets.h"
5
4
 
5
+ using namespace plusui;
6
+
6
7
  // ============================================================================
7
8
  // {{PROJECT_NAME}} - Configuration
8
9
  // ============================================================================
@@ -104,7 +105,7 @@ struct WebGPUConfig {
104
105
  // ============================================================================
105
106
  int main() {
106
107
  // Use your app name as the variable name
107
- auto {{PROJECT_NAME_LOWER}} = plusui::createApp()
108
+ auto {{PROJECT_NAME_LOWER}} = createApp()
108
109
  .title(appConfig.name)
109
110
  .width(windowConfig.width)
110
111
  .height(windowConfig.height)
@@ -167,24 +168,24 @@ int main() {
167
168
  // FILE DROP EVENTS (Drag & Drop)
168
169
  // ========================================
169
170
  // Listen for files dropped into the window
170
- plusui::event::on("fileDrop.filesDropped", [](const std::string& data) {
171
+ event::on("fileDrop.filesDropped", [](const std::string& data) {
171
172
  std::cout << "Files dropped: " << data << std::endl;
172
173
  // Parse the JSON data to get file info
173
174
  // You can process files here in C++
174
175
  });
175
176
 
176
- plusui::event::on("fileDrop.dragEnter", [](const std::string&) {
177
+ event::on("fileDrop.dragEnter", [](const std::string&) {
177
178
  std::cout << "Drag entered window" << std::endl;
178
179
  });
179
180
 
180
- plusui::event::on("fileDrop.dragLeave", [](const std::string&) {
181
+ event::on("fileDrop.dragLeave", [](const std::string&) {
181
182
  std::cout << "Drag left window" << std::endl;
182
183
  });
183
184
 
184
185
  // ========================================
185
186
  // RUN APPLICATION
186
187
  // ========================================
187
- plusui::App runtime;
188
+ App runtime;
188
189
  runtime.run();
189
190
 
190
191
  return 0;