tawasuyu

tawasuyu/brahman

Rust 202TOML 61JSON 7HTML 12471 Definiciones

gioser-web: move page-controls to static HTML, simplify sync

- Moved the minimize/close buttons from dynamic JS creation to
  static HTML in index.html (always present, hidden by default)
- sync_page_controls() now just toggles opacity/pointer-events
  instead of creating DOM elements

5f4d260301db82566b98f7f77ae2835ffe1b3be7 · por Sergio · (hace 5 meses) · padre fa8dfd6ed · ver el árbol en este commit

Delta semántico · 19

crates/apps/gioser-web/pkg/gioser_web.d.ts

crates/apps/gioser-web/src/lib.rs

6 archivos · +54 −62

diff --git a/crates/apps/gioser-web/index.html b/crates/apps/gioser-web/index.html
index b3de887..bda9bbd 100644
--- a/crates/apps/gioser-web/index.html
+++ b/crates/apps/gioser-web/index.html
@@ -75,6 +75,15 @@
     <div id="deck-strip" class="deck-strip vista-strip" role="region" aria-label="Vistas abiertas"></div>
   </div>
 
+  <!-- Controles fijos de página: minimizar y cerrar (siempre en el DOM,
+       ocultos por CSS hasta que el deck se abre) -->
+  <div class="page-controls" id="global-page-controls" style="opacity:0;pointer-events:none;">
+    <button class="page-control-btn page-minimize" data-minimize="" type="button" aria-label="Minimizar">
+      <svg viewBox="0 0 24 24" aria-hidden="true"><path d="M5 19 H19" stroke="currentColor" stroke-width="2" fill="none" stroke-linecap="round"/></svg>
+    </button>
+    <button class="page-control-btn page-close" data-close-page="" type="button" aria-label="Cerrar">×</button>
+  </div>
+
   <!-- TASKBAR estilo Windows: home + GioSer + tabs + copyleft -->
   <nav class="taskbar" aria-label="Barra de vistas">
     <button class="taskbar-home" data-home aria-label="Volver al home" type="button">
diff --git a/crates/apps/gioser-web/pkg/gioser_web.d.ts b/crates/apps/gioser-web/pkg/gioser_web.d.ts
index dfcbe74..3aa20cf 100644
--- a/crates/apps/gioser-web/pkg/gioser_web.d.ts
+++ b/crates/apps/gioser-web/pkg/gioser_web.d.ts
@@ -8,15 +8,15 @@ export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembl
 export interface InitOutput {
     readonly memory: WebAssembly.Memory;
     readonly boot: () => void;
-    readonly __wasm_bindgen_func_elem_234: (a: number, b: number, c: number) => void;
-    readonly __wasm_bindgen_func_elem_1460: (a: number, b: number, c: number, d: number) => void;
     readonly __wasm_bindgen_func_elem_233: (a: number, b: number, c: number) => void;
-    readonly __wasm_bindgen_func_elem_233_3: (a: number, b: number, c: number) => void;
-    readonly __wasm_bindgen_func_elem_515: (a: number, b: number, c: number) => void;
-    readonly __wasm_bindgen_func_elem_635: (a: number, b: number, c: number) => void;
-    readonly __wasm_bindgen_func_elem_515_6: (a: number, b: number, c: number) => void;
-    readonly __wasm_bindgen_func_elem_307: (a: number, b: number, c: number) => void;
-    readonly __wasm_bindgen_func_elem_308: (a: number, b: number) => void;
+    readonly __wasm_bindgen_func_elem_1459: (a: number, b: number, c: number, d: number) => void;
+    readonly __wasm_bindgen_func_elem_232: (a: number, b: number, c: number) => void;
+    readonly __wasm_bindgen_func_elem_232_3: (a: number, b: number, c: number) => void;
+    readonly __wasm_bindgen_func_elem_514: (a: number, b: number, c: number) => void;
+    readonly __wasm_bindgen_func_elem_634: (a: number, b: number, c: number) => void;
+    readonly __wasm_bindgen_func_elem_514_6: (a: number, b: number, c: number) => void;
+    readonly __wasm_bindgen_func_elem_306: (a: number, b: number, c: number) => void;
+    readonly __wasm_bindgen_func_elem_307: (a: number, b: number) => void;
     readonly __wbindgen_export: (a: number, b: number) => number;
     readonly __wbindgen_export2: (a: number, b: number, c: number, d: number) => number;
     readonly __wbindgen_export3: (a: number) => void;
diff --git a/crates/apps/gioser-web/pkg/gioser_web.js b/crates/apps/gioser-web/pkg/gioser_web.js
index 0f65406..c18ffa2 100644
--- a/crates/apps/gioser-web/pkg/gioser_web.js
+++ b/crates/apps/gioser-web/pkg/gioser_web.js
@@ -597,47 +597,47 @@ function __wbg_get_imports() {
         },
         __wbindgen_cast_0000000000000001: function(arg0, arg1) {
             // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 196, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
-            const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_1460);
+            const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_1459);
             return addHeapObject(ret);
         },
         __wbindgen_cast_0000000000000002: function(arg0, arg1) {
             // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [F64], shim_idx: 2, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
-            const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_234);
+            const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_233);
             return addHeapObject(ret);
         },
         __wbindgen_cast_0000000000000003: function(arg0, arg1) {
             // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("Event")], shim_idx: 6, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
-            const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_233);
+            const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_232);
             return addHeapObject(ret);
         },
         __wbindgen_cast_0000000000000004: function(arg0, arg1) {
             // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("KeyboardEvent")], shim_idx: 6, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
-            const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_233_3);
+            const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_232_3);
             return addHeapObject(ret);
         },
         __wbindgen_cast_0000000000000005: function(arg0, arg1) {
             // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("MouseEvent")], shim_idx: 144, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
-            const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_515);
+            const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_514);
             return addHeapObject(ret);
         },
         __wbindgen_cast_0000000000000006: function(arg0, arg1) {
             // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("MouseEvent")], shim_idx: 190, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
-            const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_635);
+            const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_634);
             return addHeapObject(ret);
         },
         __wbindgen_cast_0000000000000007: function(arg0, arg1) {
             // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("PointerEvent")], shim_idx: 144, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
-            const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_515_6);
+            const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_514_6);
             return addHeapObject(ret);
         },
         __wbindgen_cast_0000000000000008: function(arg0, arg1) {
             // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("PointerEvent")], shim_idx: 74, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
-            const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_307);
+            const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_306);
             return addHeapObject(ret);
         },
         __wbindgen_cast_0000000000000009: function(arg0, arg1) {
             // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [], shim_idx: 76, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
-            const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_308);
+            const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_307);
             return addHeapObject(ret);
         },
         __wbindgen_cast_000000000000000a: function(arg0, arg1) {
@@ -664,38 +664,38 @@ function __wbg_get_imports() {
     };
 }
 
-function __wasm_bindgen_func_elem_308(arg0, arg1) {
-    wasm.__wasm_bindgen_func_elem_308(arg0, arg1);
+function __wasm_bindgen_func_elem_307(arg0, arg1) {
+    wasm.__wasm_bindgen_func_elem_307(arg0, arg1);
 }
 
-function __wasm_bindgen_func_elem_233(arg0, arg1, arg2) {
-    wasm.__wasm_bindgen_func_elem_233(arg0, arg1, addHeapObject(arg2));
+function __wasm_bindgen_func_elem_232(arg0, arg1, arg2) {
+    wasm.__wasm_bindgen_func_elem_232(arg0, arg1, addHeapObject(arg2));
 }
 
-function __wasm_bindgen_func_elem_233_3(arg0, arg1, arg2) {
-    wasm.__wasm_bindgen_func_elem_233_3(arg0, arg1, addHeapObject(arg2));
+function __wasm_bindgen_func_elem_232_3(arg0, arg1, arg2) {
+    wasm.__wasm_bindgen_func_elem_232_3(arg0, arg1, addHeapObject(arg2));
 }
 
-function __wasm_bindgen_func_elem_515(arg0, arg1, arg2) {
-    wasm.__wasm_bindgen_func_elem_515(arg0, arg1, addHeapObject(arg2));
+function __wasm_bindgen_func_elem_514(arg0, arg1, arg2) {
+    wasm.__wasm_bindgen_func_elem_514(arg0, arg1, addHeapObject(arg2));
 }
 
-function __wasm_bindgen_func_elem_635(arg0, arg1, arg2) {
-    wasm.__wasm_bindgen_func_elem_635(arg0, arg1, addHeapObject(arg2));
+function __wasm_bindgen_func_elem_634(arg0, arg1, arg2) {
+    wasm.__wasm_bindgen_func_elem_634(arg0, arg1, addHeapObject(arg2));
 }
 
-function __wasm_bindgen_func_elem_515_6(arg0, arg1, arg2) {
-    wasm.__wasm_bindgen_func_elem_515_6(arg0, arg1, addHeapObject(arg2));
+function __wasm_bindgen_func_elem_514_6(arg0, arg1, arg2) {
+    wasm.__wasm_bindgen_func_elem_514_6(arg0, arg1, addHeapObject(arg2));
 }
 
-function __wasm_bindgen_func_elem_307(arg0, arg1, arg2) {
-    wasm.__wasm_bindgen_func_elem_307(arg0, arg1, addHeapObject(arg2));
+function __wasm_bindgen_func_elem_306(arg0, arg1, arg2) {
+    wasm.__wasm_bindgen_func_elem_306(arg0, arg1, addHeapObject(arg2));
 }
 
-function __wasm_bindgen_func_elem_1460(arg0, arg1, arg2) {
+function __wasm_bindgen_func_elem_1459(arg0, arg1, arg2) {
     try {
         const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
-        wasm.__wasm_bindgen_func_elem_1460(retptr, arg0, arg1, addHeapObject(arg2));
+        wasm.__wasm_bindgen_func_elem_1459(retptr, arg0, arg1, addHeapObject(arg2));
         var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
         var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
         if (r1) {
@@ -706,8 +706,8 @@ function __wasm_bindgen_func_elem_1460(arg0, arg1, arg2) {
     }
 }
 
-function __wasm_bindgen_func_elem_234(arg0, arg1, arg2) {
-    wasm.__wasm_bindgen_func_elem_234(arg0, arg1, arg2);
+function __wasm_bindgen_func_elem_233(arg0, arg1, arg2) {
+    wasm.__wasm_bindgen_func_elem_233(arg0, arg1, arg2);
 }
 
 function addHeapObject(obj) {
diff --git a/crates/apps/gioser-web/pkg/gioser_web_bg.wasm b/crates/apps/gioser-web/pkg/gioser_web_bg.wasm
index 6dc08de..5384615 100644
Binary files a/crates/apps/gioser-web/pkg/gioser_web_bg.wasm and b/crates/apps/gioser-web/pkg/gioser_web_bg.wasm differ
diff --git a/crates/apps/gioser-web/pkg/gioser_web_bg.wasm.d.ts b/crates/apps/gioser-web/pkg/gioser_web_bg.wasm.d.ts
index 91b6d92..d197d17 100644
--- a/crates/apps/gioser-web/pkg/gioser_web_bg.wasm.d.ts
+++ b/crates/apps/gioser-web/pkg/gioser_web_bg.wasm.d.ts
@@ -2,15 +2,15 @@
 /* eslint-disable */
 export const memory: WebAssembly.Memory;
 export const boot: () => void;
-export const __wasm_bindgen_func_elem_234: (a: number, b: number, c: number) => void;
-export const __wasm_bindgen_func_elem_1460: (a: number, b: number, c: number, d: number) => void;
 export const __wasm_bindgen_func_elem_233: (a: number, b: number, c: number) => void;
-export const __wasm_bindgen_func_elem_233_3: (a: number, b: number, c: number) => void;
-export const __wasm_bindgen_func_elem_515: (a: number, b: number, c: number) => void;
-export const __wasm_bindgen_func_elem_635: (a: number, b: number, c: number) => void;
-export const __wasm_bindgen_func_elem_515_6: (a: number, b: number, c: number) => void;
-export const __wasm_bindgen_func_elem_307: (a: number, b: number, c: number) => void;
-export const __wasm_bindgen_func_elem_308: (a: number, b: number) => void;
+export const __wasm_bindgen_func_elem_1459: (a: number, b: number, c: number, d: number) => void;
+export const __wasm_bindgen_func_elem_232: (a: number, b: number, c: number) => void;
+export const __wasm_bindgen_func_elem_232_3: (a: number, b: number, c: number) => void;
+export const __wasm_bindgen_func_elem_514: (a: number, b: number, c: number) => void;
+export const __wasm_bindgen_func_elem_634: (a: number, b: number, c: number) => void;
+export const __wasm_bindgen_func_elem_514_6: (a: number, b: number, c: number) => void;
+export const __wasm_bindgen_func_elem_306: (a: number, b: number, c: number) => void;
+export const __wasm_bindgen_func_elem_307: (a: number, b: number) => void;
 export const __wbindgen_export: (a: number, b: number) => number;
 export const __wbindgen_export2: (a: number, b: number, c: number, d: number) => number;
 export const __wbindgen_export3: (a: number) => void;
diff --git a/crates/apps/gioser-web/src/lib.rs b/crates/apps/gioser-web/src/lib.rs
index c84867e..1c6031e 100644
--- a/crates/apps/gioser-web/src/lib.rs
+++ b/crates/apps/gioser-web/src/lib.rs
@@ -193,30 +193,13 @@ impl AppState {
     }
 
     fn sync_page_controls(&self) {
-        let exists = self.document.get_element_by_id("global-page-controls");
-        let is_visible = self.state.borrow().active.is_some();
-        if let Some(ctl) = exists {
+        if let Some(ctl) = self.document.get_element_by_id("global-page-controls") {
+            let is_visible = self.state.borrow().active.is_some();
             ctl.set_attribute("style", if is_visible {
                 "opacity:1;pointer-events:auto;"
             } else {
                 "opacity:0;pointer-events:none;"
             }).ok();
-        } else if is_visible {
-            let Some(body) = self.document.body() else { return };
-            let div: HtmlElement = self.document
-                .create_element("div")
-                .ok()
-                .and_then(|e| e.dyn_into().ok())
-                .unwrap();
-            div.set_id("global-page-controls");
-            div.set_attribute("class", "page-controls").ok();
-            div.set_inner_html(
-                "<button class=\"page-control-btn page-minimize\" data-minimize=\"\" type=\"button\" aria-label=\"Minimizar\">\
-                    <svg viewBox=\"0 0 24 24\" aria-hidden=\"true\"><path d=\"M5 19 H19\" stroke=\"currentColor\" stroke-width=\"2\" fill=\"none\" stroke-linecap=\"round\"/></svg>\
-                </button>\
-                <button class=\"page-control-btn page-close\" data-close-page=\"\" type=\"button\" aria-label=\"Cerrar\">×</button>"
-            );
-            body.append_child(&div).ok();
         }
     }