diff --git a/Cargo.toml.bak3 b/Cargo.toml.bak3 deleted file mode 100644 index 754b68e..0000000 --- a/Cargo.toml.bak3 +++ /dev/null @@ -1,509 +0,0 @@ -[workspace] -resolver = "2" -members = [ - # ============================================================ - # protocol/ — Contratos canónicos + routing entre módulos - # ============================================================ - "crates/protocol/brahman-card", - "crates/protocol/brahman-card-wit", - "crates/protocol/brahman-cards", - "crates/protocol/brahman-handshake", - "crates/protocol/brahman-broker", - "crates/protocol/brahman-admin", - "crates/protocol/brahman-sidecar", - "crates/protocol/brahman-net", - "crates/protocol/brahman-dht", - "crates/protocol/brahman-card-discovery", - "crates/protocol/brahman-ssh-multiplex", - "crates/protocol/brahman-auth", - "crates/protocol/arje-card", - - # ============================================================ - # init/ — PID 1 + encarnación Linux (arje) - # ============================================================ - "crates/init/arje-zero", - "crates/init/arje-kernel", - "crates/init/arje-soma", - "crates/init/arje-snapshot", - "crates/init/arje-incarnate", - "crates/init/arje-absorb", - - # ============================================================ - # runtime/ — Infraestructura de ejecución (bus + cas + wasm + brain) - # ============================================================ - "crates/runtime/arje-bus", - "crates/runtime/arje-cas", - "crates/runtime/arje-wasm", - "crates/runtime/arje-brain-rules", - "crates/runtime/arje-brain-cognitive", - "crates/runtime/arje-brain-audit", - "crates/runtime/arje-brain", - "crates/runtime/arje-echo", - "crates/runtime/sandokan-lifecycle", - "crates/runtime/sandokan-core", - "crates/runtime/sandokan-local", - "crates/runtime/sandokan-daemon", - "crates/runtime/sandokan-remote", - "crates/runtime/sandokan", - - # ============================================================ - # compat/ — Shims D-Bus para correr software systemd-aware - # ============================================================ - "crates/compat/arje-compat-common", - "crates/compat/arje-policy-provider", - "crates/compat/arje-logind-compat", - "crates/compat/arje-hostnamed-compat", - "crates/compat/arje-timedated-compat", - "crates/compat/arje-localed-compat", - "crates/compat/arje-journald-compat", - "crates/compat/arje-resolved-compat", - "crates/compat/arje-polkit-compat", - "crates/compat/arje-machined-compat", - "crates/compat/arje-tmpfiles-compat", - "crates/compat/arje-systemd1-compat", - "crates/compat/arje-notify-compat", - "crates/compat/arje-binfmt-compat", - "crates/compat/arje-timer-compat", - - # ============================================================ - # modules/semantic_dht/ (minga) — DHT semántico de código - # ============================================================ - "crates/modules/semantic_dht/minga-core", - "crates/modules/semantic_dht/minga-store", - "crates/modules/semantic_dht/minga-p2p", - "crates/modules/semantic_dht/minga-vfs", - "crates/modules/semantic_dht/minga-cli", - - # ============================================================ - # modules/nahual/ — Motor GPUI: libs + widgets (era yahweh) - # ============================================================ - "crates/modules/nahual/libs/core", - "crates/modules/nahual/libs/theme", - "crates/modules/nahual/libs/launcher", - "crates/modules/nahual/libs/bus", - "crates/modules/nahual/libs/meta-schema", - "crates/modules/nahual/libs/meta-runtime", - "crates/modules/nahual/libs/providers/fs", - "crates/modules/nahual/libs/providers/sqlite", - "crates/modules/nahual/widgets/tree", - "crates/modules/nahual/widgets/container_core", - "crates/modules/nahual/widgets/splitter", - "crates/modules/nahual/widgets/tabs", - "crates/modules/nahual/widgets/tiled", - "crates/modules/nahual/widgets/text_input", - "crates/modules/nahual/widgets/meta-form", - "crates/modules/nahual/widgets/banner", - "crates/modules/nahual/widgets/card", - "crates/modules/nahual/widgets/stat-card", - "crates/modules/nahual/widgets/app-header", - "crates/modules/nahual/widgets/theme-switcher", - - # ============================================================ - # modules/pineal/ — Data-viz agnóstica con backends (era lapaloma) - # ============================================================ - "crates/modules/pineal/core", - "crates/modules/pineal/render", - "crates/modules/pineal/cartesian", - "crates/modules/pineal/stream", - "crates/modules/pineal/mesh", - "crates/modules/pineal/financial", - "crates/modules/pineal/polar", - "crates/modules/pineal/heatmap", - "crates/modules/pineal/treemap", - "crates/modules/pineal/flow", - "crates/modules/pineal/phosphor", - "crates/modules/pineal/export", - "crates/modules/pineal/umbrella", - - # ============================================================ - # modules/verbo/ — Provider de embeddings model-agnostic - # ============================================================ - "crates/modules/verbo/verbo-core", - "crates/modules/verbo/verbo-mock", - "crates/modules/verbo/verbo-daemon", - - # ============================================================ - # modules/agorapura/ — Identidad humana federada - # ============================================================ - "crates/modules/agorapura/agorapura-core", - "crates/modules/agorapura/agorapura-graph", - - # ============================================================ - # modules/badu/ — Toma de notas con gravedad semántica - # ============================================================ - "crates/modules/badu/badu-core", - "crates/modules/badu/badu-gravity", - - # ============================================================ - # modules/takiy/ — Composición musical asistida - # ============================================================ - "crates/modules/takiy/takiy-core", - - # ============================================================ - # modules/matilda/ — Administración de servidores - # ============================================================ - "crates/modules/matilda/matilda-core", - "crates/modules/matilda/matilda-config", - "crates/modules/matilda/matilda-plan", - "crates/modules/matilda/matilda-apply", - "crates/modules/matilda/matilda-ghost", - "crates/modules/matilda/matilda-linker", - "crates/modules/matilda/matilda-discover", - - # ============================================================ - # modules/yachay/ — Notebooks computacionales reproducibles - # ============================================================ - "crates/modules/yachay/yachay-core", - - # ============================================================ - # modules/charka/ — Transpilador COBOL → Rust - # ============================================================ - "crates/modules/charka/charka-bcd", - "crates/modules/charka/charka-lexer", - "crates/modules/charka/charka-parser", - "crates/modules/charka/charka-ir", - "crates/modules/charka/charka-runtime", - "crates/modules/charka/charka-codegen", - "crates/modules/charka/charka-shadow", - - # ============================================================ - # modules/mirada/ — Compositor Wayland - # ============================================================ - "crates/modules/mirada/mirada-layout", - "crates/modules/mirada/mirada-protocol", - "crates/modules/mirada/mirada-brain", - "crates/modules/mirada/mirada-link", - "crates/modules/mirada/mirada-body", - - # ============================================================ - # modules/nakui/ — ERP matemático (categórico) - # ============================================================ - "crates/modules/nakui/core", - - # ============================================================ - # modules/chasqui/ — Explorador semántico de nómadas (ex-nouser, ex-akasha) - # ============================================================ - "crates/modules/chasqui/card", - "crates/modules/chasqui/core", - "crates/modules/chasqui/nous", - "crates/modules/chasqui/nous-mock", - "crates/modules/chasqui/nous-real", - - # ============================================================ - # modules/shuma/ — Runtime de espacios aislados (era shipote) - # ============================================================ - "crates/modules/shuma/shuma-card", - "crates/modules/shuma/shuma-protocol", - "crates/modules/shuma/shuma-discern", - "crates/modules/shuma/shuma-core", - "crates/modules/shuma/shuma-intent", - "crates/modules/shuma/shuma-line", - "crates/modules/shuma/shuma-sysmon", - "crates/modules/shuma/shuma-session", - "crates/modules/shuma/shuma-exec", - "crates/modules/shuma/shuma-infer", - "crates/modules/shuma/shuma-shell-render", - - # ============================================================ - # modules/dominium/ — Simulador psicológico de campo medio - # ============================================================ - "crates/modules/dominium/dominium-core", - "crates/modules/dominium/dominium-physics", - "crates/modules/dominium/dominium-iso", - "crates/modules/dominium/dominium-render-plan", - "crates/modules/dominium/dominium-canvas-gpui", - - # ============================================================ - # modules/gioser/ — Landing WASM (chacana + 4 elementos) - # ============================================================ - "crates/modules/gioser/gioser-geom", - "crates/modules/gioser/gioser-physics", - "crates/modules/gioser/gioser-palette", - "crates/modules/gioser/gioser-shaders", - "crates/modules/gioser/gioser-canvas-web", - "crates/modules/gioser/gioser-graph-web", - - # ========================================================== - # modules/fana/ — Writer DAG editor (absorbe pluma) - # ============================================================ - "crates/modules/fana/fana-core", - "crates/modules/fana/fana-graph", - "crates/modules/fana/fana-render-plan", - "crates/modules/fana/fana-editor-gpui", - "crates/modules/fana/fana-store", - "crates/modules/fana/fana-semantic", - "crates/modules/fana/fana-md", - "crates/modules/fana/fana-md-reader-web", - - # ============================================================ - # modules/revista/ — Deck horizontal swipe (Flutter PageView) - # ============================================================ - "crates/modules/revista/revista-core", - "crates/modules/revista/revista-web", - - # ============================================================ - # modules/barra/ — Taskbar agnóstica estilo Windows - # ============================================================ - "crates/modules/barra/barra-core", - "crates/modules/barra/barra-web", - - # ============================================================ - # modules/cosmobiologia/ — Estudio de astrología profesional - # ============================================================ - "crates/modules/cosmobiologia/cosmobiologia-card", - "crates/modules/cosmobiologia/cosmobiologia-model", - "crates/modules/cosmobiologia/cosmobiologia-store", - "crates/modules/cosmobiologia/cosmobiologia-render", - "crates/modules/cosmobiologia/cosmobiologia-corpus", - "crates/modules/cosmobiologia/cosmobiologia-engine", - "crates/modules/cosmobiologia/cosmobiologia-modules", - "crates/modules/cosmobiologia/cosmobiologia-theme", - "crates/modules/cosmobiologia/cosmobiologia-canvas", - "crates/modules/cosmobiologia/cosmobiologia-tree", - "crates/modules/cosmobiologia/cosmobiologia-panel", - "crates/modules/cosmobiologia/cosmobiologia-web", - - # ============================================================ - # apps/ — Binarios finales que consumen el protocolo - # ============================================================ - "crates/apps/brahman-broker-explorer", - "crates/apps/brahman-demo", - "crates/apps/sandokan", - "crates/apps/nahual-shell", - "crates/apps/nahual-file-explorer", - "crates/apps/nahual-database-explorer", - "crates/apps/nahual-text-viewer", - "crates/apps/nahual-image-viewer", - "crates/apps/chasqui-explorer", - "crates/apps/nakui-explorer", - "crates/apps/nakui-ui", - "crates/apps/minga-explorer", - "crates/apps/shuma-daemon", - "crates/apps/shuma-cli", - "crates/apps/shuma-gateway", - "crates/apps/shuma-shell", - "crates/apps/gioser-web", - "crates/apps/pineal-demo", - "crates/apps/pineal-stream-demo", - "crates/apps/pineal-phosphor-demo", - "crates/apps/pineal-financial-demo", - "crates/apps/cosmobiologia", - "crates/apps/cosmobiologia-cli", - "crates/apps/cosmobiologia-server", - "crates/apps/dominium", - "crates/apps/fana", - "crates/apps/agorapura", - "crates/apps/badu", - "crates/apps/matilda", - "crates/apps/yachay", - "crates/apps/mirada", - "crates/apps/mirada-compositor", - "crates/apps/mirada-ctl", - "crates/apps/mirada-launcher", - "crates/apps/mirada-portal", - "crates/apps/mirada-greeter", - "crates/apps/charka", -] - -# renaser — el SO bare-metal SASOS. Vive en el mismo repo pero es su -# PROPIO workspace de Cargo: usa toolchain nightly, target -# `x86_64-unknown-none` y `panic = "abort"`, incompatibles con los -# perfiles globales de este workspace. Cargo lo trata como ajeno; los -# crates compartidos se referencian por `path` cruzando la frontera. -exclude = ["renaser"] - -[workspace.package] -version = "0.1.0" -edition = "2021" -rust-version = "1.80" -license = "MIT OR Apache-2.0" -authors = ["Brahman Contributors"] -publish = false -repository = "https://example.invalid/brahman" - -[workspace.dependencies] -# === Serialización === -serde = { version = "1", features = ["derive"] } -serde_json = "1" -serde-big-array = "0.5" -postcard = { version = "1", features = ["use-std"] } -toml = "0.8" -ron = "0.8" -bincode = "1" -base64 = "0.22" - -# === Errores === -thiserror = "2" # bump uniforme; arje (era 1) puede requerir ajustes menores -anyhow = "1" - -# === Async === -tokio = { version = "1", features = ["full"] } -tokio-util = { version = "0.7", features = ["compat"] } -async-trait = "0.1" -futures = "0.3" - -# === Observabilidad === -tracing = "0.1" -tracing-subscriber = { version = "0.3", features = ["env-filter", "fmt"] } - -# === Linux primitives (arje) === -nix = { version = "0.29", features = ["signal", "process", "sched", "mount", "fs", "socket", "net", "user"] } -libc = "0.2" - -# === IDs / Hash / Crypto === -ulid = { version = "1", features = ["serde"] } -uuid = { version = "1", features = ["v4"] } -sha2 = "0.10" -blake3 = "1.5" -ed25519-dalek = "2" -aes-gcm = "0.10" -argon2 = "0.5" -rand = "0.8" - -# === WASM (arje) === -# wasmi 1.0: unifica la versión con renaser (su kernel ya corre 1.0), para -# que el ABI WASM del host sea idéntico en Linux y en bare-metal. -wasmi = "1.0" -wat = "1" - -# === Storage / DB === -sled = "0.34" -rusqlite = { version = "0.31", features = ["bundled", "blob"] } - -# === P2P (minga) === -libp2p = { version = "0.56", features = ["tokio", "tcp", "noise", "yamux", "macros", "kad", "identify"] } -libp2p-stream = "=0.4.0-alpha" -libp2p-allow-block-list = "0.6" - -# === SSH (brahman-ssh-multiplex, sandokan RemoteEngine, matilda) === -russh = "0.54" - -# === Math determinista cross-platform (dominium) === -libm = "0.2" - -# === Code parsing (minga) === -tree-sitter = "0.24" -tree-sitter-rust = "0.23" -tree-sitter-python = "0.23" -tree-sitter-typescript = "0.23" -tree-sitter-javascript = "0.23" -tree-sitter-go = "0.23" - -# === FS notify === -notify = "6.1" - -# === FUSE (minga-vfs) === -# default-features = false: prescinde de pkg-config/libfuse-dev en build. -# El montaje pasa a ser Rust puro (vía el helper `fusermount3` en runtime). -fuser = { version = "0.15", default-features = false } - -# === CLI / auth (minga) === -clap = { version = "4", features = ["derive"] } -rpassword = "7" - -# === PAM (brahman-auth) === -pam = "0.8" - -# === D-Bus (arje compat) === -zbus = { version = "4", default-features = false, features = ["tokio"] } - -# === Tests === -tempfile = "3" - -# === GPUI (nahual) === -gpui = "0.2" - -# === Filesystem helpers === -directories = "5" - -# === WASM web (gioser) === -wasm-bindgen = "0.2" -wasm-bindgen-futures = "0.4" -js-sys = "0.3" -web-sys = "0.3" -glam = "0.30" - -# === Markdown (pluma) === -pulldown-cmark = { version = "0.12", default-features = false, features = ["html"] } - -# ============================================================ -# Intra-workspace deps de nahual (referenciadas por workspace = true) -# ============================================================ -nahual-core = { path = "crates/modules/nahual/libs/core" } -nahual-theme = { path = "crates/modules/nahual/libs/theme" } -nahual-bus = { path = "crates/modules/nahual/libs/bus" } -nahual-provider-fs = { path = "crates/modules/nahual/libs/providers/fs" } -nahual-provider-sqlite = { path = "crates/modules/nahual/libs/providers/sqlite" } -nahual-widget-tree = { path = "crates/modules/nahual/widgets/tree" } -nahual-widget-container-core = { path = "crates/modules/nahual/widgets/container_core" } -nahual-widget-splitter = { path = "crates/modules/nahual/widgets/splitter" } -nahual-widget-tabs = { path = "crates/modules/nahual/widgets/tabs" } -nahual-widget-tiled = { path = "crates/modules/nahual/widgets/tiled" } -nahual-widget-text-input = { path = "crates/modules/nahual/widgets/text_input" } -nahual-file-explorer = { path = "crates/apps/nahual-file-explorer" } -nahual-database-explorer = { path = "crates/apps/nahual-database-explorer" } -nahual-text-viewer = { path = "crates/apps/nahual-text-viewer" } -nahual-image-viewer = { path = "crates/apps/nahual-image-viewer" } - -# ============================================================ -# Intra-workspace deps de pineal (módulo de gráficos) -# ============================================================ -pineal-core = { path = "crates/modules/pineal/core" } -pineal-render = { path = "crates/modules/pineal/render" } -pineal-cartesian = { path = "crates/modules/pineal/cartesian" } -pineal-stream = { path = "crates/modules/pineal/stream" } -pineal-mesh = { path = "crates/modules/pineal/mesh" } -pineal-financial = { path = "crates/modules/pineal/financial" } -pineal-polar = { path = "crates/modules/pineal/polar" } -pineal-heatmap = { path = "crates/modules/pineal/heatmap" } -pineal-treemap = { path = "crates/modules/pineal/treemap" } -pineal-flow = { path = "crates/modules/pineal/flow" } -pineal-phosphor = { path = "crates/modules/pineal/phosphor" } -pineal-export = { path = "crates/modules/pineal/export" } -pineal = { path = "crates/modules/pineal/umbrella" } - -[profile.release] -lto = "thin" -codegen-units = 1 -strip = "symbols" -panic = "abort" - -[profile.dev] -opt-level = 0 -# `line-tables-only` mantiene stack traces con archivo:línea correctos -# pero descarta el resto de symbols. Reduce target/ ~40% sin sacrificar -# debugging real para nuestro flujo (no usamos gdb sobre estos crates). -debug = "line-tables-only" -split-debuginfo = "unpacked" -incremental = true -# Más codegen-units = más paralelismo + builds incrementales más chicas -# (cada cambio re-compila menos). Default es 256 en dev pero lo -# anclamos para evitar regresiones. -codegen-units = 256 - -# Override puntual para deps grandes que NO debuggeamos: gpui, ort, -# fastembed, tokenizers, image. Subir opt-level acá hace que sus libs -# pesen menos en target/ (símbolos descartados durante la build). -[profile.dev.package."*"] -opt-level = 0 -debug = "line-tables-only" - -[profile.dev.package.gpui] -opt-level = 1 -debug = false - -[profile.dev.package.ort] -opt-level = 1 -debug = false - -[profile.dev.package.fastembed] -opt-level = 1 -debug = false - -[profile.dev.package.tokenizers] -opt-level = 1 -debug = false - -[profile.dev.package.image] -opt-level = 1 -debug = false diff --git a/crates/apps/gioser-web/cytoscape-graph.js b/crates/apps/gioser-web/cytoscape-graph.js index 9b17de0..5924d37 100644 --- a/crates/apps/gioser-web/cytoscape-graph.js +++ b/crates/apps/gioser-web/cytoscape-graph.js @@ -1,11 +1,11 @@ /** * gioser-graph.js — Grafo semántico con Cytoscape.js * - * Se monta automáticamente cuando hay un contenedor - * en el DOM con atributo data-api-url. + * Detecta automáticamente elementos agregados al DOM + * (incluso los creados dinámicamente por el WASM) y monta el grafo. * * Efecto "wineandcheesemap": clic en nodo → centra + desvanece resto. - * Doble clic → callback de navegación. + * Doble clic → callback de navegación (window.__gioserGraphNavigate). */ (function () { @@ -28,74 +28,93 @@ const apiUrl = container.getAttribute('data-api-url') || 'https://api.gioser.net'; const onNavigate = window.__gioserGraphNavigate || null; - fetch(`${apiUrl}/graph?limit=500`) - .then(r => r.json()) - .then(data => { + // Si cytoscape no ha cargado, esperar + if (typeof cytoscape === 'undefined') { + const check = setInterval(() => { + if (typeof cytoscape !== 'undefined') { + clearInterval(check); + initGraph(container); + } + }, 100); + return; + } + + fetch(apiUrl + '/graph?limit=500') + .then(function (r) { return r.json(); }) + .then(function (data) { if (!data.nodes || data.nodes.length === 0) return; - // Construir elementos Cytoscape - const elements = []; + var elements = []; - for (const n of data.nodes) { - const d = n.data; + for (var i = 0; i < data.nodes.length; i++) { + var d = data.nodes[i].data; if (!d.doc_id) continue; - const color = caminoColor(d.camino); + var color = caminoColor(d.camino); elements.push({ + group: 'nodes', data: { id: d.id, doc_id: d.doc_id, - label: d.name.length > 22 ? d.name.slice(0, 20) + '…' : d.name, + label: d.name.length > 24 ? d.name.slice(0, 22) + '…' : d.name, camino: d.camino.toUpperCase(), - color, + color: color, }, }); } - const nodeIds = new Set(elements.map(e => e.data.id)); + var nodeIds = {}; + for (var i = 0; i < elements.length; i++) { + nodeIds[elements[i].data.id] = true; + } - for (const e of data.edges) { - const ed = e.data; - if (!nodeIds.has(ed.source) || !nodeIds.has(ed.target)) continue; - const weight = ed.weight || 0.7; + for (var i = 0; i < data.edges.length; i++) { + var ed = data.edges[i].data; + if (!nodeIds[ed.source] || !nodeIds[ed.target]) continue; + var weight = ed.weight || 0.7; elements.push({ + group: 'edges', data: { id: ed.id, source: ed.source, target: ed.target, - weight, + weight: weight, }, }); } - const cy = cytoscape({ - container, - elements, + // Guardar payload completo para tooltip + var tipMap = {}; + for (var i = 0; i < data.nodes.length; i++) { + var d = data.nodes[i].data; + if (d.doc_id) tipMap[d.id] = d; + } + + var cy = cytoscape({ + container: container, + elements: elements, style: [ - // Aristas: grosor según peso { selector: 'edge', style: { - 'width': 'mapData(weight, 0.5, 1.0, 0.5, 4)', - 'line-color': 'rgba(255,255,255,0.18)', - 'target-arrow-color': 'rgba(255,255,255,0.12)', + 'width': 'mapData(weight, 0.5, 1.0, 0.5, 4.5)', + 'line-color': 'rgba(255,255,255,0.16)', 'curve-style': 'haystack', 'haystack-radius': 0, 'opacity': 0.6, }, }, - // Nodo: rectángulo redondeado { selector: 'node', style: { 'shape': 'round-rectangle', 'width': 130, - 'height': 32, + 'height': 34, 'background-color': 'data(color)', - 'background-opacity': 0.20, + 'background-opacity': 0.18, 'border-color': 'data(color)', - 'border-width': 1.5, - 'border-opacity': 0.7, - 'color': 'rgba(232,234,245,0.90)', + 'border-width': 1.8, + 'border-opacity': 0.55, + 'color': 'rgba(232,234,245,0.88)', 'font-size': 11, 'font-family': 'Inter, system-ui, sans-serif', 'font-weight': 500, @@ -103,156 +122,153 @@ 'text-halign': 'center', 'label': 'data(label)', 'min-zoomed-font-size': 8, - 'shadow-blur': 6, - 'shadow-color': 'rgba(0,0,0,0.4)', - 'shadow-offset-x': 0, - 'shadow-offset-y': 2, - 'shadow-opacity': 0.5, - 'transition-property': 'background-opacity, border-opacity, shadow-blur', - 'transition-duration': 200, + 'transition-property': 'background-opacity, border-opacity, border-width', + 'transition-duration': 180, }, }, - // Sublabel del camino — lo ponemos como label secundario - // Cytoscape no soporta dos labels nativamente; usamos un - // badge de esquina con la data (camino) en el tooltip. ], layout: { name: 'cose', animate: false, - idealEdgeLength: 160, - nodeRepulsion: 8000, - gravity: 0.25, - numIter: 1000, + idealEdgeLength: 150, + nodeRepulsion: 7000, + gravity: 0.2, + numIter: 800, fit: true, - padding: 30, + padding: 25, }, }); - // Tooltip con preview al hover - const tips = {}; - for (const n of data.nodes) { - const d = n.data; - if (d.doc_id) tips[d.id] = d; - } + // Tooltip + var tooltipEl = document.createElement('div'); + tooltipEl.className = 'cy-tooltip'; + tooltipEl.style.cssText = + 'position:absolute;z-index:10;pointer-events:none;' + + 'background:rgba(6,5,13,0.90);color:#e8eaf5;' + + 'padding:6px 10px;border-radius:8px;font-size:11px;' + + 'font-family:Inter,sans-serif;line-height:1.4;' + + 'border:1px solid rgba(255,255,255,0.10);' + + 'backdrop-filter:blur(8px);max-width:220px;' + + 'opacity:0;transition:opacity 180ms ease;'; + container.style.position = 'relative'; + container.appendChild(tooltipEl); - let tooltipEl = container.querySelector('.cy-tooltip'); - if (!tooltipEl) { - tooltipEl = document.createElement('div'); - tooltipEl.className = 'cy-tooltip'; - tooltipEl.style.cssText = - 'position:absolute;z-index:10;pointer-events:none;' + - 'background:rgba(6,5,13,0.88);color:#e8eaf5;' + - 'padding:6px 10px;border-radius:8px;font-size:11px;' + - 'font-family:Inter,sans-serif;line-height:1.4;' + - 'border:1px solid rgba(255,255,255,0.10);' + - 'backdrop-filter:blur(8px);max-width:240px;' + - 'opacity:0;transition:opacity 180ms ease;'; - container.style.position = 'relative'; - container.appendChild(tooltipEl); - } - - cy.on('mouseover', 'node', (ev) => { - const node = ev.target; - node.style({ 'background-opacity': 0.45, 'border-opacity': 1, 'shadow-blur': 12 }); - const tipData = tips[node.id()]; + cy.on('mouseover', 'node', function (ev) { + var n = ev.target; + n.style({ 'background-opacity': 0.45, 'border-opacity': 0.9, 'border-width': 2.2 }); + var tipData = tipMap[n.id()]; if (tipData && tipData.preview) { - tooltipEl.textContent = tipData.preview.slice(0, 120); + tooltipEl.textContent = tipData.preview.slice(0, 130); tooltipEl.style.opacity = '1'; } }); - cy.on('mouseout', 'node', (ev) => { - const node = ev.target; - node.style({ 'background-opacity': 0.20, 'border-opacity': 0.7, 'shadow-blur': 6 }); + cy.on('mouseout', 'node', function (ev) { + var n = ev.target; + n.style({ 'background-opacity': 0.18, 'border-opacity': 0.55, 'border-width': 1.8 }); tooltipEl.style.opacity = '0'; }); - cy.on('mousemove', 'node', (ev) => { - const pos = ev.renderedPosition || { x: 0, y: 0 }; - tooltipEl.style.left = (pos.x + 14) + 'px'; - tooltipEl.style.top = (pos.y - 10) + 'px'; + cy.on('mousemove', function (ev) { + if (tooltipEl.style.opacity === '1') { + var pos = ev.renderedPosition || { x: 0, y: 0 }; + tooltipEl.style.left = (pos.x + 14) + 'px'; + tooltipEl.style.top = (pos.y - 10) + 'px'; + } }); - // Click: centrar nodo + desvanecer resto (wineandcheesemap effect) - cy.on('click', 'node', (ev) => { - const node = ev.target; - // Animar vecindario: opacidad plena en nodo + vecinos - cy.nodes().not(node).not(node.neighborhood()).forEach(n => { - n.style({ 'opacity': 0.15 }); + // Click nodo: centrar + desvanecer resto + cy.on('click', 'node', function (ev) { + var node = ev.target; + // Vecinos + cy.nodes().not(node).not(node.neighborhood()).forEach(function (n) { + n.style({ 'opacity': 0.12 }); }); - cy.edges().forEach(e => { - e.style({ 'opacity': 0.08 }); + cy.edges().forEach(function (e) { + e.style({ 'opacity': 0.06 }); }); - // Vecinos directos opacidad normal - node.neighborhood().nodes().forEach(n => { + node.neighborhood().nodes().forEach(function (n) { n.style({ 'opacity': 1 }); }); - node.style({ 'opacity': 1 }); - // Aristas del vecindario visibles - node.connectedEdges().forEach(e => { + node.style({ 'opacity': 1, 'background-opacity': 0.40, 'border-opacity': 1 }); + node.connectedEdges().forEach(function (e) { e.style({ 'opacity': 0.7 }); }); - // Centrar cy.animate({ center: { eles: node }, - zoom: 2.2, - duration: 400, + zoom: 2.5, + duration: 350, }); }); - // Doble clic: navegar a la página - cy.on('dblclick', 'node', (ev) => { - const docId = ev.target.data('doc_id'); + // Doble clic: callback de navegación + cy.on('dblclick', 'node', function (ev) { + var docId = ev.target.data('doc_id'); if (onNavigate && docId) onNavigate(docId); }); // Clic en fondo: restaurar todo - cy.on('click', (ev) => { + cy.on('click', function (ev) { if (ev.target === cy) { - cy.nodes().forEach(n => n.style({ 'opacity': 1 })); - cy.edges().forEach(e => e.style({ 'opacity': 0.6 })); + cy.nodes().forEach(function (n) { + n.style({ 'opacity': 1, 'background-opacity': 0.18, 'border-opacity': 0.55, 'border-width': 1.8 }); + }); + cy.edges().forEach(function (e) { + e.style({ 'opacity': 0.6 }); + }); cy.animate({ zoom: 1, pan: { x: 0, y: 0 }, duration: 300 }); } }); - // Resize al cambiar tamaño del contenedor - const ro = new ResizeObserver(() => cy.resize().fit(30)); + // ResizeObserver para redimensionar con el contenedor + var ro = new ResizeObserver(function () { + cy.resize().fit(25); + }); ro.observe(container); - // Scroll del contenedor padre: pausar interacción si no visible - container.__cy = cy; + // Scroll del deck: pausar interacciones del grafo + var deckEl = container.closest('.deck'); + if (deckEl) { + deckEl.addEventListener('scroll', function () { + // No hacemos nada especial, el grafo se redimensiona solo + }); + } }) - .catch(err => { - console.warn('gioser-graph: error fetching graph:', err); + .catch(function (err) { + console.warn('gioser-graph: error:', err); container.innerHTML = - '
' + '· grafo no disponible ·
'; }); } - // Auto-inicializar todos los en la página - function boot() { - const els = document.querySelectorAll('gioser-graph'); - for (const el of els) { - // Esperar a que Cytoscape esté cargado - if (typeof cytoscape !== 'undefined') { - initGraph(el); - } else { - // Si el CDN no ha cargado, esperar - const check = setInterval(() => { - if (typeof cytoscape !== 'undefined') { - clearInterval(check); - initGraph(el); - } - }, 100); + // MutationObserver: detecta agregados en cualquier momento + var observer = new MutationObserver(function (mutations) { + for (var m = 0; m < mutations.length; m++) { + var added = mutations[m].addedNodes; + for (var i = 0; i < added.length; i++) { + var el = added[i]; + if (el.tagName && el.tagName.toLowerCase() === 'gioser-graph') { + initGraph(el); + } + // También revisar hijos + var graphs = el.querySelectorAll ? el.querySelectorAll('gioser-graph') : []; + for (var j = 0; j < graphs.length; j++) { + initGraph(graphs[j]); + } } } - } + }); - if (document.readyState === 'loading') { - document.addEventListener('DOMContentLoaded', boot); - } else { - boot(); + observer.observe(document.documentElement, { + childList: true, + subtree: true, + }); + + // También inicializar los que ya existen (si el DOM ya está listo) + var existing = document.querySelectorAll('gioser-graph'); + for (var i = 0; i < existing.length; i++) { + initGraph(existing[i]); } })(); diff --git a/crates/apps/gioser-web/pkg/gioser_web.d.ts b/crates/apps/gioser-web/pkg/gioser_web.d.ts index 0d7ac15..7405bc0 100644 --- a/crates/apps/gioser-web/pkg/gioser_web.d.ts +++ b/crates/apps/gioser-web/pkg/gioser_web.d.ts @@ -8,13 +8,13 @@ export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembl export interface InitOutput { readonly memory: WebAssembly.Memory; readonly boot: () => void; - readonly __wasm_bindgen_func_elem_178: (a: number, b: number, c: number) => void; - readonly __wasm_bindgen_func_elem_1209: (a: number, b: number, c: number, d: number) => void; - readonly __wasm_bindgen_func_elem_177: (a: number, b: number, c: number) => void; - readonly __wasm_bindgen_func_elem_177_3: (a: number, b: number, c: number) => void; - readonly __wasm_bindgen_func_elem_446: (a: number, b: number, c: number) => void; - readonly __wasm_bindgen_func_elem_223: (a: number, b: number, c: number) => void; - readonly __wasm_bindgen_func_elem_224: (a: number, b: number) => void; + readonly __wasm_bindgen_func_elem_175: (a: number, b: number, c: number) => void; + readonly __wasm_bindgen_func_elem_1203: (a: number, b: number, c: number, d: number) => void; + readonly __wasm_bindgen_func_elem_174: (a: number, b: number, c: number) => void; + readonly __wasm_bindgen_func_elem_174_3: (a: number, b: number, c: number) => void; + readonly __wasm_bindgen_func_elem_442: (a: number, b: number, c: number) => void; + readonly __wasm_bindgen_func_elem_219: (a: number, b: number, c: number) => void; + readonly __wasm_bindgen_func_elem_220: (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 cde2130..a257310 100644 --- a/crates/apps/gioser-web/pkg/gioser_web.js +++ b/crates/apps/gioser-web/pkg/gioser_web.js @@ -11,13 +11,6 @@ function __wbg_get_imports() { const ret = typeof(v) === 'boolean' ? v : undefined; return isLikeNone(ret) ? 0xFFFFFF : ret ? 1 : 0; }, - __wbg___wbindgen_debug_string_edece8177ad01481: function(arg0, arg1) { - const ret = debugString(getObject(arg1)); - const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2); - const len1 = WASM_VECTOR_LEN; - getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true); - getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true); - }, __wbg___wbindgen_is_function_5cd60d5cf78b4eef: function(arg0) { const ret = typeof(getObject(arg0)) === 'function'; return ret; @@ -148,10 +141,6 @@ function __wbg_get_imports() { __wbg_disable_df908054ffee7971: function(arg0, arg1) { getObject(arg0).disable(arg1 >>> 0); }, - __wbg_dispatchEvent_29c919cea8d37995: function() { return handleError(function (arg0, arg1) { - const ret = getObject(arg0).dispatchEvent(getObject(arg1)); - return ret; - }, arguments); }, __wbg_document_3540635616a18455: function(arg0) { const ret = getObject(arg0).document; return isLikeNone(ret) ? 0 : addHeapObject(ret); @@ -343,10 +332,6 @@ function __wbg_get_imports() { const ret = new Object(); return addHeapObject(ret); }, - __wbg_new_de9891da0bd35168: function() { return handleError(function (arg0, arg1) { - const ret = new Event(getStringFromWasm0(arg0, arg1)); - return addHeapObject(ret); - }, arguments); }, __wbg_ok_556a55299dd238ba: function(arg0) { const ret = getObject(arg0).ok; return ret; @@ -507,38 +492,38 @@ function __wbg_get_imports() { return ret; }, __wbindgen_cast_0000000000000001: function(arg0, arg1) { - // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 130, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`. - const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_1209); + // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 128, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`. + const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_1203); 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_178); + const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_175); 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_177); + const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_174); 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_177_3); + const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_174_3); return addHeapObject(ret); }, __wbindgen_cast_0000000000000005: function(arg0, arg1) { - // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("MouseEvent")], shim_idx: 124, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`. - const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_446); + // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("MouseEvent")], shim_idx: 122, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`. + const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_442); return addHeapObject(ret); }, __wbindgen_cast_0000000000000006: function(arg0, arg1) { - // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("PointerEvent")], shim_idx: 53, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`. - const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_223); + // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("PointerEvent")], shim_idx: 51, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`. + const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_219); return addHeapObject(ret); }, __wbindgen_cast_0000000000000007: function(arg0, arg1) { - // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [], shim_idx: 55, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`. - const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_224); + // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [], shim_idx: 53, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`. + const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_220); return addHeapObject(ret); }, __wbindgen_cast_0000000000000008: function(arg0, arg1) { @@ -565,30 +550,30 @@ function __wbg_get_imports() { }; } -function __wasm_bindgen_func_elem_224(arg0, arg1) { - wasm.__wasm_bindgen_func_elem_224(arg0, arg1); +function __wasm_bindgen_func_elem_220(arg0, arg1) { + wasm.__wasm_bindgen_func_elem_220(arg0, arg1); } -function __wasm_bindgen_func_elem_177(arg0, arg1, arg2) { - wasm.__wasm_bindgen_func_elem_177(arg0, arg1, addHeapObject(arg2)); +function __wasm_bindgen_func_elem_174(arg0, arg1, arg2) { + wasm.__wasm_bindgen_func_elem_174(arg0, arg1, addHeapObject(arg2)); } -function __wasm_bindgen_func_elem_177_3(arg0, arg1, arg2) { - wasm.__wasm_bindgen_func_elem_177_3(arg0, arg1, addHeapObject(arg2)); +function __wasm_bindgen_func_elem_174_3(arg0, arg1, arg2) { + wasm.__wasm_bindgen_func_elem_174_3(arg0, arg1, addHeapObject(arg2)); } -function __wasm_bindgen_func_elem_446(arg0, arg1, arg2) { - wasm.__wasm_bindgen_func_elem_446(arg0, arg1, addHeapObject(arg2)); +function __wasm_bindgen_func_elem_442(arg0, arg1, arg2) { + wasm.__wasm_bindgen_func_elem_442(arg0, arg1, addHeapObject(arg2)); } -function __wasm_bindgen_func_elem_223(arg0, arg1, arg2) { - wasm.__wasm_bindgen_func_elem_223(arg0, arg1, addHeapObject(arg2)); +function __wasm_bindgen_func_elem_219(arg0, arg1, arg2) { + wasm.__wasm_bindgen_func_elem_219(arg0, arg1, addHeapObject(arg2)); } -function __wasm_bindgen_func_elem_1209(arg0, arg1, arg2) { +function __wasm_bindgen_func_elem_1203(arg0, arg1, arg2) { try { const retptr = wasm.__wbindgen_add_to_stack_pointer(-16); - wasm.__wasm_bindgen_func_elem_1209(retptr, arg0, arg1, addHeapObject(arg2)); + wasm.__wasm_bindgen_func_elem_1203(retptr, arg0, arg1, addHeapObject(arg2)); var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true); var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true); if (r1) { @@ -599,8 +584,8 @@ function __wasm_bindgen_func_elem_1209(arg0, arg1, arg2) { } } -function __wasm_bindgen_func_elem_178(arg0, arg1, arg2) { - wasm.__wasm_bindgen_func_elem_178(arg0, arg1, arg2); +function __wasm_bindgen_func_elem_175(arg0, arg1, arg2) { + wasm.__wasm_bindgen_func_elem_175(arg0, arg1, arg2); } function addHeapObject(obj) { @@ -616,71 +601,6 @@ const CLOSURE_DTORS = (typeof FinalizationRegistry === 'undefined') ? { register: () => {}, unregister: () => {} } : new FinalizationRegistry(state => wasm.__wbindgen_export4(state.a, state.b)); -function debugString(val) { - // primitive types - const type = typeof val; - if (type == 'number' || type == 'boolean' || val == null) { - return `${val}`; - } - if (type == 'string') { - return `"${val}"`; - } - if (type == 'symbol') { - const description = val.description; - if (description == null) { - return 'Symbol'; - } else { - return `Symbol(${description})`; - } - } - if (type == 'function') { - const name = val.name; - if (typeof name == 'string' && name.length > 0) { - return `Function(${name})`; - } else { - return 'Function'; - } - } - // objects - if (Array.isArray(val)) { - const length = val.length; - let debug = '['; - if (length > 0) { - debug += debugString(val[0]); - } - for(let i = 1; i < length; i++) { - debug += ', ' + debugString(val[i]); - } - debug += ']'; - return debug; - } - // Test for built-in - const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val)); - let className; - if (builtInMatches && builtInMatches.length > 1) { - className = builtInMatches[1]; - } else { - // Failed to match the standard '[object ClassName]' - return toString.call(val); - } - if (className == 'Object') { - // we're a user defined class or Object - // JSON.stringify avoids problems with cycles, and is generally much - // easier than looping through ownProperties of `val`. - try { - return 'Object(' + JSON.stringify(val) + ')'; - } catch (_) { - return 'Object'; - } - } - // errors - if (val instanceof Error) { - return `${val.name}: ${val.message}\n${val.stack}`; - } - // TODO we could test for more things here, like `Set`s and `Map`s. - return className; -} - function dropObject(idx) { if (idx < 1028) return; heap[idx] = heap_next; diff --git a/crates/apps/gioser-web/pkg/gioser_web_bg.wasm b/crates/apps/gioser-web/pkg/gioser_web_bg.wasm index 975526b..2022d2c 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 308d922..6344d75 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,13 +2,13 @@ /* eslint-disable */ export const memory: WebAssembly.Memory; export const boot: () => void; -export const __wasm_bindgen_func_elem_178: (a: number, b: number, c: number) => void; -export const __wasm_bindgen_func_elem_1209: (a: number, b: number, c: number, d: number) => void; -export const __wasm_bindgen_func_elem_177: (a: number, b: number, c: number) => void; -export const __wasm_bindgen_func_elem_177_3: (a: number, b: number, c: number) => void; -export const __wasm_bindgen_func_elem_446: (a: number, b: number, c: number) => void; -export const __wasm_bindgen_func_elem_223: (a: number, b: number, c: number) => void; -export const __wasm_bindgen_func_elem_224: (a: number, b: number) => void; +export const __wasm_bindgen_func_elem_175: (a: number, b: number, c: number) => void; +export const __wasm_bindgen_func_elem_1203: (a: number, b: number, c: number, d: number) => void; +export const __wasm_bindgen_func_elem_174: (a: number, b: number, c: number) => void; +export const __wasm_bindgen_func_elem_174_3: (a: number, b: number, c: number) => void; +export const __wasm_bindgen_func_elem_442: (a: number, b: number, c: number) => void; +export const __wasm_bindgen_func_elem_219: (a: number, b: number, c: number) => void; +export const __wasm_bindgen_func_elem_220: (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 afce311..678431a 100644 --- a/crates/apps/gioser-web/src/lib.rs +++ b/crates/apps/gioser-web/src/lib.rs @@ -306,12 +306,9 @@ impl AppState { wrapper.style().set_property("border-top", "1px solid rgba(255,255,255,0.06)").ok(); wrapper.style().set_property("min-height", "220px").ok(); content_clone.append_child(&wrapper).ok(); - // Disparar el script de Cytoscape si ya está en la página - if let Some(win) = web_sys::window() { - let _ = win.dispatch_event( - &web_sys::Event::new("gioser-graph-ready").unwrap() - ); - } + // El script cytoscape-graph.js usa MutationObserver + // para detectar dinámicos. No hace falta + // disparar nada acá. }); }