@owear/linux-x64-gnu 0.1.2 → 0.1.4

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.
File without changes
File without changes
Binary file
package/bin/modules/fs.so CHANGED
File without changes
File without changes
Binary file
Binary file
File without changes
File without changes
Binary file
File without changes
Binary file
Binary file
File without changes
Binary file
Binary file
Binary file
package/bin/owear CHANGED
Binary file
@@ -0,0 +1,74 @@
1
+ // Copyright 2026 Owear Contributors
2
+ // SPDX-License-Identifier: Apache-2.0
3
+ //
4
+ // api/menu/src/menu_template.hpp — parser común del template de menú.
5
+ //
6
+ // Formato (igual que el SDK): { id?, label?, role?, type?, checked?, enabled?,
7
+ // visible?, accelerator?, icon?(base64 png), submenu?: [...] }
8
+ //
9
+ #pragma once
10
+
11
+ #include "ow/Json.h"
12
+
13
+ #include <string>
14
+ #include <vector>
15
+
16
+ namespace ow::menu {
17
+
18
+ using ow::json::Value;
19
+
20
+ struct Item {
21
+ std::string id;
22
+ std::string label;
23
+ std::string role;
24
+ std::string type = "normal"; // normal|separator|checkbox|radio
25
+ bool checked = false;
26
+ bool enabled = true;
27
+ bool visible = true;
28
+ std::string accelerator;
29
+ std::string icon; // PNG en base64 (opcional)
30
+ std::vector<Item> submenu;
31
+ };
32
+
33
+ inline Item ParseItem(const Value& v) {
34
+ Item it;
35
+ auto str = [&](const char* k, std::string& out) {
36
+ if (const Value* p = v.Find(k); p && p->IsString()) out = p->AsString();
37
+ };
38
+ auto boolean = [&](const char* k, bool& out) {
39
+ if (const Value* p = v.Find(k); p && p->IsBool()) out = p->AsBool();
40
+ };
41
+ str("id", it.id);
42
+ str("label", it.label);
43
+ str("role", it.role);
44
+ str("type", it.type);
45
+ str("accelerator", it.accelerator);
46
+ str("icon", it.icon);
47
+ boolean("checked", it.checked);
48
+ boolean("enabled", it.enabled);
49
+ boolean("visible", it.visible);
50
+ if (const Value* sub = v.Find("submenu"); sub && sub->IsArray())
51
+ for (const auto& s : sub->AsArray()) it.submenu.push_back(ParseItem(s));
52
+ return it;
53
+ }
54
+
55
+ inline std::vector<Item> ParseItems(const Value& arr) {
56
+ std::vector<Item> out;
57
+ if (arr.IsArray())
58
+ for (const auto& v : arr.AsArray()) out.push_back(ParseItem(v));
59
+ return out;
60
+ }
61
+
62
+ /// Payload de click: {"id":..,"role":..,"windowId":N}
63
+ inline std::string ClickPayload(const Item& it, uint32_t windowId) {
64
+ std::string j = "{\"id\":";
65
+ j += ow::json::Value(it.id).Serialize();
66
+ j += ",\"role\":";
67
+ j += ow::json::Value(it.role).Serialize();
68
+ j += ",\"windowId\":";
69
+ j += std::to_string(windowId);
70
+ j += "}";
71
+ return j;
72
+ }
73
+
74
+ } // namespace ow::menu
@@ -18,9 +18,12 @@ enum class TitleBarStyle {
18
18
 
19
19
  struct TitleBarOverlay {
20
20
  bool enabled = false;
21
- std::string color = "#00000000"; // fondo bajo los botones nativos
22
- std::string symbolColor = "#ffffff"; // color de glifos (min/max/close)
23
- int height = 36; // alto en px lógicos
21
+ std::string color = "#00000000"; // fondo de la banda (alpha 0 = transparente)
22
+ // Color de los glifos. Vacío = lo decide el tema/SO.
23
+ std::string symbolColor;
24
+ // Color de fondo interno de los botones (el "círculo"). Vacío = tema/SO.
25
+ std::string buttonColor;
26
+ int height = 32; // alto de la banda en px lógicos (default de Electron)
24
27
  };
25
28
 
26
29
  struct WindowOptions {
@@ -33,6 +36,24 @@ struct WindowOptions {
33
36
  bool center = true;
34
37
  bool show = true;
35
38
  bool frameless = false;
39
+ bool movable = true;
40
+ bool minimizable = true;
41
+ bool maximizable = true;
42
+ bool closable = true;
43
+ bool fullscreenable = true;
44
+ bool skipTaskbar = false;
45
+ bool alwaysOnTop = false;
46
+ bool hasShadow = true;
47
+ bool transparent = false;
48
+ std::string backgroundColor; // "#RRGGBB" o vacío = por defecto
49
+
50
+ /// Ventana padre (owner/transient) y si es modal respecto a ella.
51
+ WindowId parent = 0;
52
+ bool modal = false;
53
+
54
+ /// Relación de aspecto fija (0 = libre). `aspectExtraW/H` = margen extra.
55
+ double aspectRatio = 0.0;
56
+ int aspectExtraW = 0, aspectExtraH = 0;
36
57
 
37
58
  TitleBarStyle titleBarStyle = TitleBarStyle::Default;
38
59
  TitleBarOverlay titleBarOverlay;
@@ -40,6 +61,10 @@ struct WindowOptions {
40
61
  /// URL inicial: http(s):// (dev server), app://<bundle>/... o file://
41
62
  std::string url = "app://index.html";
42
63
 
64
+ /// Partición de sesión (aislamiento de cookies/storage por perfil).
65
+ /// Vacío = perfil por defecto de la app. Ej: "persist:cuenta-2".
66
+ std::string session;
67
+
43
68
  /// Argumentos extra para el proceso del WebView (debug flags, etc).
44
69
  std::vector<std::string> webviewArgs;
45
70
  };
@@ -50,6 +75,13 @@ using ListenerId = uint64_t;
50
75
 
51
76
  class Window : NonCopyable {
52
77
  public:
78
+ struct Bounds {
79
+ int x = 0, y = 0, w = 0, h = 0;
80
+ };
81
+ struct Size {
82
+ int width = 0, height = 0;
83
+ };
84
+
53
85
  explicit Window(const WindowOptions& options);
54
86
  ~Window();
55
87
 
@@ -72,8 +104,44 @@ public:
72
104
  bool IsMinimized() const;
73
105
  bool IsFullScreen() const;
74
106
 
107
+ // ── estado extendido (paridad Electron) ────────────────────────
108
+ bool IsVisible() const;
109
+ bool IsFocused() const;
110
+ bool IsResizable() const;
111
+ bool IsMovable() const;
112
+ bool IsMinimizable() const;
113
+ bool IsMaximizable() const;
114
+ bool IsClosable() const;
115
+ bool IsAlwaysOnTop() const;
116
+ bool IsKiosk() const;
117
+ bool IsDestroyed() const;
118
+
119
+ void SetResizable(bool on);
120
+ void SetMovable(bool on);
121
+ void SetMinimizable(bool on);
122
+ void SetMaximizable(bool on);
123
+ void SetClosable(bool on);
124
+ void SetAlwaysOnTop(bool on, int level = 0);
125
+ void SetSkipTaskbar(bool on);
126
+ void SetHasShadow(bool on);
127
+ void SetKiosk(bool on);
128
+ void SetIgnoreMouseEvents(bool ignore, bool forward);
129
+ /// value ∈ [-1,1] (-1 = indeterminado). mode: none|normal|indeterminate|paused|error
130
+ void SetProgressBar(double value, const std::string& mode = "normal");
131
+ void SetBackgroundColor(const std::string& color);
132
+ void MoveTop();
133
+ void SetAspectRatio(double ratio, int extraW = 0, int extraH = 0);
134
+
135
+ // ── geometría extendida ────────────────────────────────────────
136
+ Bounds GetContentBounds() const;
137
+ void SetContentSize(int w, int h);
138
+ Size GetContentSize() const;
139
+ Size GetMinimumSize() const;
140
+ Size GetMaximumSize() const;
141
+ void SetMinimumSize(int w, int h);
142
+ void SetMaximumSize(int w, int h);
143
+
75
144
  // ── geometría ──────────────────────────────────────────────────
76
- struct Bounds { int x = 0, y = 0, w = 0, h = 0; };
77
145
  Bounds GetBounds() const;
78
146
  void SetBounds(const Bounds&);
79
147
  void Center();
@@ -84,6 +152,37 @@ public:
84
152
  void SetTitleBarStyle(TitleBarStyle style);
85
153
  void SetTitleBarOverlay(const TitleBarOverlay& overlay);
86
154
 
155
+ // ── webviews embebidas (hijas de esta ventana) ─────────────────────
156
+ // Cada una es un WebView independiente (con su proceso), embebido como hijo
157
+ // y controlable por API. Linux de momento.
158
+ /// Crea una webview hija. `optionsJson`:
159
+ /// { url?, x?, y?, width?, height?, transparent?, userAgent? }.
160
+ /// Devuelve JSON {"id":N}.
161
+ std::string CreateWebview(const std::string& optionsJson);
162
+ /// Control de una webview. `op` ∈ setBounds|load|back|forward|reload|stop|
163
+ /// canBack|canForward|getURL|getTitle|eval|setVisible|setZoom|devtools|
164
+ /// findInPage|findStop|destroy. Devuelve JSON con el resultado.
165
+ std::string WebviewCommand(uint32_t id, const std::string& op,
166
+ const std::string& argsJson);
167
+
168
+ /// Registra un esquema de ProtocolRegistry en el webview de esta ventana
169
+ /// (se llama al crear la ventana y al registrar un esquema ya con ventanas).
170
+ void RegisterProtocol(const std::string& scheme);
171
+
172
+ /// Captura la página del WebView (PNG) de forma ASÍNCRONA.
173
+ void CapturePage(std::function<void(bool ok, const std::string& png)> cb);
174
+
175
+ /// Aplica (o quita) el menubar de aplicación. `itemsJson` = array de items
176
+ /// (mismo formato que `menu.popup`). Windows: HMENU nativo; Linux: noop.
177
+ void SetApplicationMenu(const std::string& itemsJson);
178
+
179
+ /// Fuerza el esquema de color del contenido: 0=auto (sistema), 1=light, 2=dark.
180
+ /// Windows: WebView2 `PreferredColorScheme`; Linux: noop (WebKitGTK no lo expone).
181
+ void SetColorScheme(int mode);
182
+
183
+ /// Exporta la página a PDF de forma asíncrona (`ok` + bytes PDF).
184
+ void PrintToPDF(std::function<void(bool ok, const std::string& pdf)> cb);
185
+
87
186
  // ── webview ────────────────────────────────────────────────────
88
187
  void LoadURL(const std::string& url);
89
188
  /// Evalúa JS en la página. callback recibe el resultado JSON o null.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@owear/linux-x64-gnu",
3
- "version": "0.1.2",
3
+ "version": "0.1.4",
4
4
  "description": "Owear runtime — kernel nativo + módulos stock (.owm) + headers. Linux x64 (glibc).",
5
5
  "license": "Apache-2.0",
6
6
  "homepage": "https://owear.dev",
@@ -33,5 +33,7 @@
33
33
  "README.md",
34
34
  "LICENSE"
35
35
  ],
36
- "scripts": {}
37
- }
36
+ "scripts": {
37
+ "prepack": "node ../../tools/pack-runtime.mjs --target linux-x64-gnu"
38
+ }
39
+ }