import { tr } from '../../../src/lib/ui-i18n.ts'; import { LitElement, html } from 'lit'; import { labStyles, defineVersionedElement } from './styles.js'; export class RuntimeWorkbench extends LitElement { static componentVersion = '1.0.0'; static properties = { model: { attribute:false } }; static styles = labStyles; constructor() { super(); this.model=null; } intent(action) { this.dispatchEvent(new CustomEvent('wu-runtime-intent',{detail:{action},bubbles:true,composed:true})); } render() { const m=this.model; if(!m) return html`

${tr("Preparando runtime…")}

`; return html`

${tr("Inspeccionar la composición")}

${tr("Observa cómo los cambios y comandos llegan desde la otra app.")}

${tr("Contador compartido")}

${m.connected?tr("En directo"):tr("En pausa")}
${m.counter}

${tr("Últimos eventos")} ${m.events.length}

    ${m.events.length?m.events.map(e=>html`
  1. ${e.name}${e.description}
  2. `):html`
  3. ${tr("Aún no hay eventos.")}${tr("Publica un comando o cambia el contador para verlo aquí.")}
  4. `}
${m.connected?tr("{0} suscripciones activas", [m.listeners]):tr("Al reconectar se lee el estado actual.")}

${m.status}

${tr("Último comando compartido")}

${m.lastCommand?html`
${m.lastCommand}
`:html`

${tr("Usa «Publicar en el bus» en el constructor para recibirlo.")}

`}
${tr("Lifecycle y suscripciones")}
${m.mounts}${tr("montajes Vue")}
${m.unmounts}${tr("desmontajes completos")}
${m.listeners}${tr("suscripciones activas")}
${m.cleanups}${tr("suscripciones liberadas")}
`; } } defineVersionedElement('wu-docs-runtime-workbench',RuntimeWorkbench);